Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3109 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks a lot

Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 4 19
2645
0
thg 10 23
1642
1
thg 3 23
2449
1
thg 1 25
1719
what is procurement Đã xử lý
4
thg 2 25
18064