Odoo Help


[V9]Call sale.order.line fields on delivery order

on 12/1/15, 7:54 AM 1,308 views


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):

    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,
            stock_pack_operation b,
            procurement_order c,
            sale_order_line d
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:

  1. Is there an easy way to connect sale.order.line and stock.pack.operation ?

  2. How could I use my request to inherit model "stock_pack_operation" and use it on delivery order ?

Thank you.


I also want to do the same, working with stock_pack_operation, I want to know how it is related to moves and how it is working with Qaunts.!

on 10/21/16, 7:21 AM

Any answer will be appreciated!

on 10/21/16, 7:22 AM
On 11/3/16, 7:08 AM


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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 12/1/15, 7:54 AM
Seen: 1308 times
Last updated: 11/4/16, 7:12 AM