gatekeepers = fields.Many2Many('sale.sale-party.party.gatekeepers', 'sale', 'gatekeeper',
search_context={'name': '????????'}, # <--- is that a way?!? how?
string = 'Gatekeepers for the Sale Order',
help = 'Select gatekeepers for this sale order',
)
class GatekeepersPartyRealtion(ModelSQL):
'Sales - Gatekeepers relation'
__name__ = 'sale.sale-party.party.gatekeepers'
I want to see these parties (in the list that pops up with the search) that has
‘gatekeeper’ in their category list:
Could you recommend me a way to implement it?
how to define the domain?
I guess that gatekeeper on GatekeepersPartyRealtion class is a Many2One to party.party.
So it means you want to get a domain on the Many2Many based on a specific record of category. This is not really a good design because it will require to create this category from XML so you can use PYSON Id. In such case the domain would be:
domain=[('category', '=', Id('<module>', '<gatekeeper xml id>'))]
Another way which is probably more flexible is to add on the category a Boolean field that define that this category give the right to the party to be used as gatekeeper. So the domain would be: