When used on a One2Many field, the domain '=' operator evaluates True if at
least one of the related objects meets its criterion. But is it possible
to add an additional domain clause that tests whether any objects not only
meet the first clause, but also meet the second clause?
For example, let's say I have a Car model with a 'parts' field that is
One2Many on a Part model. Part has fields (1) 'manufacturer', which is
Many2One on the standard Party model, and (2) 'warranty', which is boolean,
indicating whether the Part comes with a warranty. I want to be able to
search on Car to find all records that have warrantied parts manufactured
by Acme, Inc.
I can create a function string field for warrantying_manufacturers that
displays the names of those manufacturers who have warrantied parts on the
car, but how can I write a searcher?
Let's say I write a searcher that returns:
[
('parts.manufacturer.party.name',) + tuple(clause[1:]),
('parts.warranty', '=', True)
]
If I then search for 'Acme, Inc.' it will return all of the cars that have
both a part manufactured by Acme, and a part under warranty. But the part
under warranty may be a different part, and not the one made by Acme.
Is there any way to accomplish this?
(Note: while this example captures the essence of what I'm trying to do, it
uses more easily described/understood models.)