Browse Source

[IMP] use method to provide the default value for validation_code

pull/255/head
Laurent Mignon (ACSONE) 9 years ago
parent
commit
08eb2bcdb8
  1. 16
      partner_identification/models/res_partner_id_category.py

16
partner_identification/models/res_partner_id_category.py

@ -20,19 +20,21 @@ class ResPartnerIdCategory(models.Model):
_name = "res.partner.id_category"
_order = "name"
def _default_validation_code(self):
return _("\n# Python code. Use failed = True to specify that the id "
"number is not valid.\n"
"# You can use the following variables :\n"
"# - self: browse_record of the current ID Category "
"browse_record\n"
"# - id_number: browse_record of ID number to validate")
code = fields.Char(string="Code", size=16, required=True)
name = fields.Char(string="ID name", required=True, translate=True)
active = fields.Boolean(string="Active", default=True)
validation_code = fields.Text(
'Python validation code',
help="Python code called to validate an id number.",
default="""
# Python code. Use failed = True to specify that the id number is not valid.
# You can use the following variables :
# - self: browse_record of the current ID Category browse_record
# - id_number: browse_record of ID number to validte
"""
)
default=_default_validation_code)
@api.multi
def _validation_eval_context(self, id_number):

Loading…
Cancel
Save