Odoo Help

Welcome!

This community 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.

1

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

By
TK Fontaine
on 12/1/15, 7:54 AM 481 views

Hello,

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 :

stock_pack_operation---(picking_id+produc_id)--->stock_move--(procurement_id)--->procurement_order---(sale_line_id)--->sale_order_line

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,
            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.

FTK





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.!

Chandni
on 10/21/16, 7:21 AM

Any answer will be appreciated!

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

Hi,

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.

Thanks,

Chandni


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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