I have supply.conditions and purchase.request models. In purchase.request I have many2many relation field:
supply_ids = fields.Many2many(comodel_name='supply.conditions', relation='purchase_supply_rel', column1='purchase_requests_id', column2='supply_conditions_id',string='Supply Conditions')
In supply.conditions model I need to add domain filter to check that supply.conditions id is in purchase_supply_rel table. I want to change SQL:
select * from supply_conditions a
inner join purchase_supply_rel b
on a.id = b.supply_conditions_id
to many2many relation domain.
I tied to make domain filter like that:
[('id', '=', purchase_supply_rel.supply_conditions_id)]
But I got an error:
ValueError: "name 'purchase_supply_rel' is not defined" while evaluating
What is wrong? Do I have to have the same many2many relation in my supply.conditions model?
res.users
inres.partner
m2m field) – Dachi Darchiashvili