Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2948 Zobrazení

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.

Avatar
Zrušit
Autor

Thanks a lot

Nejlepší odpověď

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.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
dub 19
2548
0
říj 23
1451
1
bře 23
2256
1
led 25
1488
4
úno 25
17716