How can we use dynamic domains in new Odoo API?
I'm trying to do it, I have an Many2one field, and a compute One2many field. Options to be select by Many2one field should be in this One2many field.
Here are my code lines:
days = fields.One2many('af.week.day', string='Class days', compute='_compute_days',
help='Week days in which this group has classes')
day_of_week = fields.Many2one('af.week.day', string='Day of week', domain="[('id','in',days)]")
Any idea? In old api we can use something like this: def onchange_type(self,cr,uid,ids, type,context=None): product_obj = self.pool.get('product.product') product_ids = product_obj.search(cr,uid, [('type','=',type)]) return {'domain':{'product_id':[('id','in',product_ids)]}} But in new api... Thanks in advanced!
No anwers?
Send the real example what you did from your side. here in comment you have given the example of onchange method what you want to do it. you can not set dynamic domain on onchange method. give more description of your requirement. dynamic domain can be set by overriding search method of that particular model.