Hello,
I'm using Odoo 13 Community Edition.
I need some help to understand self.env.search and self.env.search clearly.
In my case I need to search some ids, but it only should find the ids that match to every given value. For example:
for rec in self:
zb_get = rec.env['stock.location'].sudo().search([('name', '=', 'MGtec: Umschlaglager')], limit=1)
domain_done = [('sale_order_id_mg', '=', rec.id), ('location_id', '=', zb_get.id), ('state', '=', 'done')]
lief_zb_ids_done = self.env['stock.picking'].sudo().search_count(domain_done)
'zb_get' catches the right id and 'sale_order_id_mg' is working too (that is a field from my custom module).
The problem is that it returns much more ids than it should.
I tried also:
domain_done = ['&', '&', ('sale_order_id_mg', '=', rec.id), ('location_id', '=', zb_get.id), ('state', '=', 'done')]
And:
domain_done = ['|', '|', ('sale_order_id_mg', '=', rec.id), ('location_id', '=', zb_get.id), ('state', '=', 'done')]
So I think I dont understand how self.env.search and self.env.search_count are working correctly.