From 0cb5724a219405a1bf42cf597efbd9f4ad05521d Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Wed, 28 Feb 2018 16:52:48 +0100 Subject: [PATCH] fix --- base_tier_validation/models/tier_definition.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/base_tier_validation/models/tier_definition.py b/base_tier_validation/models/tier_definition.py index 21b7dbc03..2c22e2d16 100644 --- a/base_tier_validation/models/tier_definition.py +++ b/base_tier_validation/models/tier_definition.py @@ -20,8 +20,6 @@ class TierDefinition(models.Model): model_id = fields.Many2one( comodel_name="ir.model", string="Referenced Model", - domain=lambda self: [ - ('model', 'in', self._get_tier_validation_model_names())], ) model = fields.Char( related='model_id.model', index=True, store=True, @@ -51,3 +49,8 @@ class TierDefinition(models.Model): default=lambda self: self.env["res.company"]._company_default_get( "tier.definition"), ) + + @api.onchange('model_id') + def onchange_model_id(self): + return {'domain': { + 'model_id': [('model', 'in', self._get_tier_validation_model_names())]}} \ No newline at end of file