I have a problem, it turns out that I want to verify the ID of my country that is "00000000-0" because it can have 7 or 8 numbers before the script and after the script it can end in 0,1,2,3,4,5,6 , 7,8,9, k. So, I have not managed to find a method to only allow me and accept that format. Could you please help me?
Example of DNI of my country:
18654675-6
19657346-k
1543564-0
I have this code
class instructor (models.Model):
_name = 'gym.instructor'
name = fields.Char (string = "Name", required = 'true')
telefono = fields.Integer (string = "Telephone +56", size = 9, required = True)
rut = fields.Char ()
address = fields.Char (string = "Address", required = True)
mail = fields.Char (string = "Email")
class_id = fields.Many2one (comodel_name = 'gym.clase', string = 'Class', required = False)
def digit_verifier (dni):
pat = re.compile ('^ \ d {7,8} - [0-9k]')
if pat.search (str (dni)) is not None:
return True
return False
record model = "ir.ui.view" id = "gym.instructor_list">
<field name = "name"> instructor list </ field>
<field name = "model"> gym.instructor </ field>
<field name = "arch" type = "xml">
<tree>
<field name = "id" />
<field name = "name" />
<field name="rut"/>
<field name = "telefono" />
<field name = "address" />
<field name = "mail" />
<field name = "class_id" />
</ tree>
</ field>
</ record>