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