Can someone tell me how I can collect all moves of a stock.picking? I only need the python code
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi,
In Odoo, you can collect all the moves of a stock.picking by using the 'move_lines' field which is a one2many field that links the stock.picking object to its associated stock.move objects. To access the moves of a specific stock.picking, you can use the following code:
picking = env['stock.picking'].browse(picking_id)
moves = picking.move_lines
You can also use the 'search()' method to find all the moves associated with a specific stock.picking by filtering on the 'picking_id' field of the stock.move object:
moves = env['stock.move'].search([('picking_id', '=', picking_id)])
In both cases, 'moves' will be a recordset of stock.move objects associated with the specific stock.picking.
Hope it helps
Hello Johann,
In stock.picking model you can use move_ids like below way.
Please find code in comment.
I hope this will help you.
Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
1. self.move_ids
OR
def method_name(self):
for picking_id in self:
for move_id in picking_id.move_ids:
your code here
.
.
.
.
.
2. In other model you can get move_ids like below way.
def method_name(self):
stock_move_obj = self.env['stock.move']
move_ids = stock_move_obj.search([('picking_id','=', 18)]) //picking_id
your code here
.
.
.
.
.
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 8 21
|
3898 | ||
|
2
thg 3 15
|
9413 | ||
|
4
thg 4 25
|
7019 | ||
|
0
thg 10 24
|
1330 | ||
|
1
thg 3 23
|
2386 |