Hello, I need help with the relation to dynamic domains in Odoo v 15
in Odoo v13 I used @api.onchange and return [('name','in',vals)]
Example:
@api.onchange('field_1')
def onchange_domain(self):
vals = []
objs = self.env['model'].search([])
for obj in objs:
vals.append(obj.code) return {'domain' : {'field_2' : [('name', 'in', vals)]}}
In Odoo v14 the console says that the method is deprecated and in OCA I found the module called "web_domain_field" which has helped me a lot to manage dynamic domains using @api.depends and return json array to field char.
< --field name-=-"product_id_domain" invisible=-"1" -/- >
< --field-name-=-"product_id" domain=-"product_id_domain"-/- >
product_id_domain = fields.Char( compute="_compute_product_id_domain", readonly=True, store=False, ) @api.multi @api.depends('name') def _compute_product_id_domain(self): for rec in self: rec.product_id_domain = json.dumps( [('type', '=', 'product'), ('name', 'like', rec.name)] )
But now in Odoo v15 there is no such module so reviewing the Odoo source code I can't find a simple way to handle this, someone who has already made a method that works in odoo v15 ?