I want to filter list view in supply.conditions and show only these values that have a m2m relation with my.request class. I don't know how can I filter it by domain.
class my_request(models.Model):
_name = 'my.request'
supply_ids = fields.Many2many(comodel_name='supply.conditions',
relation='purchase_supply_rel',
column1='purchase_requests_id', column2='supply_conditions_id',
string='Supply Conditions')
class SupplyConditions(models.Model):
_name = 'supply.conditions'
Function in SupplyConditions class:
@api.model
def search(self, args, offset=0, limit=None, order=None, count=False):
context = self.env.context or {}
if context.get('search_to_split'):
args.append(((???????)))
return super(SupplyConditions, self).search(args, offset, limit, order, count=count)
??????? - here I want to write domain that gives only these values thar have a relation with my_request class.
I tried something like that:
domain = [('supply_ids.ids', '=', self.ids)]
But I feel I am doing wrong. I don't know how else can I filter results I need.... I am going crazy with this m2m relation