Can't search moves with purchase when product kit is active
I have the following domain in my code:
moves = StockMove.search([
('shipment', '=', None),
('state', '=', 'draft'),
('purchase', '!=', None),
])
This worked perfectly until recently when the client activated the product_kit
module.
Upon investigation, I found out the problem relies on the ('purchase', '!=', None)
clause. The computed search domain is the following:
['AND', [('origin.purchase', '!=', None, 'purchase.line')], ('origin.line.purchase', '!=', None, 'purchase.line.component')]
The AND
invalidates all searchs because origin.purchase
and origin.line
can't coexist at the same time, but I wouldn't know how to fix this.