From cd604744c62d657d63aa3ae6ec5de9a4c23278a4 Mon Sep 17 00:00:00 2001 From: eLBati Date: Fri, 5 Feb 2016 15:29:20 +0100 Subject: [PATCH] rename field model_id --- base_field_validator/models/ir_model.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/base_field_validator/models/ir_model.py b/base_field_validator/models/ir_model.py index 1042cc509..4103b6550 100644 --- a/base_field_validator/models/ir_model.py +++ b/base_field_validator/models/ir_model.py @@ -19,12 +19,12 @@ class IrModel(models.Model): _inherit = 'ir.model' validator_line_ids = fields.One2many( - 'ir.model.validator.line', 'name', 'Validators') + 'ir.model.validator.line', 'model_id', 'Validators') @api.model def check_vals(self, vals, model_name): validator_lines = self.env['ir.model.validator.line'].search([ - ('name.model', '=', model_name), + ('model_id.model', '=', model_name), ('field_id.name', 'in', vals.keys())]) for validator_line in validator_lines: pattern = re.compile(validator_line.regex_id.regex) @@ -99,7 +99,8 @@ class IrModel(orm.Model): class IrModelValidatorLine(models.Model): _name = "ir.model.validator.line" - name = fields.Many2one('ir.model', string="Model", required=True) + _rec_name = 'model_id' + model_id = fields.Many2one('ir.model', string="Model", required=True) field_id = fields.Many2one('ir.model.fields', 'Field', required=True) regex_id = fields.Many2one( 'ir.model.fields.regex', string="Validator", required=True)