From f3184852e5d5d416e37628a964d883753145662b Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Wed, 16 Mar 2016 11:39:05 +0100 Subject: [PATCH] [IMP] use method to provide the default value for validation_code --- .../models/res_partner_id_category.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/partner_identification/models/res_partner_id_category.py b/partner_identification/models/res_partner_id_category.py index e0ecdea89..b1fb9b6d0 100644 --- a/partner_identification/models/res_partner_id_category.py +++ b/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):