Odoo Help


Purchase discounts on invoices

Roberto Barreiro
on 12/3/14, 7:06 AM 1,235 views

Hello, I'm working on an addon for purchase discounts, because there is no addon for v8 wich makes it. I have got discounts working on providers pricelist, and on purchase orders. After a few days, i'm mired trying to pass discounts from purchase orders to purchase invoices. On another question I made on this forum, somebody tells me to use _get_invoice_line_vals function wich belongs to stock_account/stock.py, but I can't find a way to pass discount field to invoices.

Diving on the code, I see unit_price is obtained by _get_price_unit_invoice function of stock_move class. Looking this function, I see price_unit is obtained from move_line, and now I'm a little lost. I'm not sure if the best way is to get discount like price_unit is obtained, adding a field for discount to move_line, and if this is the right way, I don't find the function wich passes values from purchase orders to move_line. In other hand, I think sale orders don't uses this way to pass discount from sale orders to sale invoices, but I don't know how odoo makes it, and this could put me on the right path.

Any help would be apreciated. Thanks in advice.



| 6 5 7
Lodz, Poland

On 12/3/14, 7:26 AM

I can not comment (karma = 50 is now rquired), so the answer:

My sugesstion is change  "Default invoicing control method" from "Based on incoming shipments" to other.

Adding a field for discount to move_line is probably not a good idea.

Thanks for your answer, I put on the trash the idea of adding a discount field to move_line. I think knowing how delivery orders are invoiced, and how the discount is transfered to the invoice would helps. The same method could be used for make invoices from incoming shipments, including the discount. If anyone can put me on the path on how sale invoices are made from delivery orders, will help me a lot. Thanks to all.

Roberto Barreiro
on 12/3/14, 11:27 AM

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/3/14, 7:06 AM
Seen: 1235 times
Last updated: 3/16/15, 8:10 AM