I already got some help on an old thread here. I would need to build a filter for products on purchase order so that all products would be listed if no vendor is selected, and only vendor related products would be listed if the user has selected the vendor.
With the earlier tips I was able to write a domain filter and test it a couple of times with success. But my modifications got written over. I had some notes, but despite a couple hours of trying I don't seem to be able to build the domain filter again. Below is the code, perhaps somebody can point the error. With the code below I get the following error when adding a product to PO (no vendor selected). I assume the error is on the first condition where I try to declare that the vendor has to be selected.
Error:
ValueError: Invalid leaf (True, '=', False)
Code:
(['|', '&', (True, '=',parent.partner_id),
('seller_ids.name','=',parent.partner_id),
('purchase_ok', '=', True), '|',
('company_id', '=', False),
('company_id', '=',parent.company_id),
'&', (False, '=', parent.partner_id),
('purchase_ok', '=', True), '|',
('company_id', '=', False),
('company_id', '=', parent.company_id)])
My Odoo version is 15.