Odoo Help


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.


Connect purchase_order_line with sale_order_line tables

Ahmed Ababneh
on 11/15/15, 4:31 AM 313 views


We need to know the sale order line which caused the purchase order line to be generated.

Sale orders are automatically generated by defining suppliers and re-ordering rules for each product.

We have the following requirement: The user needs to be able to delete some lines from the automatically generated purchase order. On deletion, it is required that the sale line (which caused the purchase line to be created) to be moved to a different delivery order.

However, there is no link between the "purchase_order_line" and "sale_order_line" tables. Additionally, when I checked the "procurement_order" table, I found a record for the sale order line (the sale_line_id is set, and purchase_line_id is empty) and another record for the purchase order line (the purchase_line_id is set, and sale_line_id is empty), and I could not find a way to connect the 2 records together.

As a solution, I am thinking of overriding the "procurement_order.make_po" method. I will fill the "purchase_line_id" field of the "procurement_order" table for the procurement orders originated from the sale orders. 

So, what is the best way to link the the "purchase_order_line" to the "sale_order_line", when the PO is automatically generated using reordering rules?

Thanks a lot

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)


Asked: 11/15/15, 4:31 AM
Seen: 313 times
Last updated: 11/15/15, 4:31 AM