Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
2981 Vizualizări

Hi all. Like the title, I am wondering how I can get delivery orders from stock.picking based on the warehouse_id in Odoo 12. My code is currently like this:

delivery_orders = self.env['stock.picking'].search(['&', ('state', '=', 'assigned'), ('warehouse_id', '=', warehouse_id)]).mapped('id')

But of course it does not work because there is no warehouse_id field in stock.picking. If anyone knows the answer, please let me know and many thanks in advance.

Imagine profil
Abandonează
Autor

Thanks a lot

Cel mai bun răspuns

Hello

warehouse id is available on the stock picking type.

so instead of use warehouse_id in stock picking use the picking_type_id.warehouse_id in your search.

like 

self.env['stock.picking'].search(['&', ('state', '=', 'assigned'), ('picking_type_id.warehouse_id', '=', warehouse_id)]).mapped('id')

Hope this will helps you.

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
apr. 19
2578
0
oct. 23
1492
1
mar. 23
2319
1
ian. 25
1564
4
feb. 25
17827