If you have a given ID for a stock_picking, what should be done to get all product_id's associated to that stock_picking?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
You could do it like this:
prod_ids = [move.product_id.id for line in self.env['stock.move'].search([('picking_id', '=', picking_id)])]
Cheers
prod_ids = [move.product_id.id for line in self.env['stock.move'].search([('picking_id', '=', id)])] AttributeError: 'Binary' object has no attribute 'env' (**** this is used inside class Binary(http.Controller): *****)
Thanks Axel, and why do I need this in a controller method? I see that given the ID I could follow your path.
Model = request.registry['stock.picking']
cr, uid, context = request.cr, request.uid, request.context
fields = [ 'id' ]
res = Model.read(cr, uid, [int(id)], fields, context)[0]
I don't understand you correctly but if you need to find the product_id for a given picking_id in a controller you could do it as I show you with the registry of models. I don't know that you need it to use it in a controller when I answer you but it's the same.
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
|
2
Mei 25
|
4690 | ||
|
1
Nov 21
|
16596 | ||
|
1
Mei 21
|
4057 | ||
|
2
Apr 20
|
5241 | ||
|
4
Okt 19
|
9827 |