Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I want to to show discount, price sell, etc. in delivery order. So I have to connect sale.order.line with stock.pack.operation.
Unfortunately, there is no easy and proper way to do that.
In fact, there is a link between them :
Here my SQL request (notice that I had state='assigned' for stock_move):
|SELECT DISTINCT |
a.id, a.product_qty, a.state, a.procurement_id, a.product_id, a.picking_id,
b.id, b.product_qty, b.picking_id,
c.id, c.sale_line_id, c.origin, c.product_qty,
d.id, d.product_uom_qty, d.price_unit, d.price_subtotal, d.discount
FROM stock_move a,
WHERE a.picking_id = b.picking_id
AND a.product_id = b.product_id
AND a.state = 'assigned'
AND a.procurement_id = c.id
AND c.sale_line_id = d.id
Here, I could show price and discount on delivery order, even if there are 2 same products on the sale order : for example 1 "Mac ref1" at 500€ and 1 "Mac ref1" at 250€ (50% because it's already used/broken).
I got 2 questions:
Is there an easy way to connect sale.order.line and stock.pack.operation ?
How could I use my request to inherit model "stock_pack_operation" and use it on delivery order ?
I was also facing the same issue. Firstly when you confirm sale order it will create Draft Delivery Order and its line. Now, line object would be stock.move, after that when you perform any kind of operation on that DO, you will see object changed. It is now stock.pack.operation.
It is coming from this method:
do_prepare_partial() of class stock_picking
you will find this line.: pack_operation_obj.create(cr, uid, vals, context=context)
It is creating pack operation from move, and where pack_operation_obj = self.pool.get('stock.pack.operation')
Now, You can use your query through pack operation object via stock.move. If reverse is there u have to work with stock.quant.package.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 12/1/15, 7:54 AM|
|Seen: 801 times|
|Last updated: 11/4/16, 7:12 AM|