From e131028dec1b070dc52531f74519738271c8c8e9 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 6 Jan 2021 11:18:19 +0000 Subject: [PATCH] [FIX] sale: Discount on re-invoicable product MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the bug: - Let's consider a re-invoicable and expensable product P at 100€ - Let's consider a pricelist PL with 20% of visible discount on every product - Let's consider a confirmed sale order SO with PL set on it - Create an expense E with P at 100€ and reinvoice customer set to SO - Generate the entries of E Bug: A new sale order line was created with 80€ as unit price and no discount instead of 20% discount. opw:2423147 closes odoo/odoo#64194 X-original-commit: 8815f4d9ab8620428d50abbe603c7f6c63076d6c Signed-off-by: Simon Goffin (sig) --- addons/sale/models/account_move.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/sale/models/account_move.py b/addons/sale/models/account_move.py index dc3ce48dd15..e944314bc5e 100644 --- a/addons/sale/models/account_move.py +++ b/addons/sale/models/account_move.py @@ -135,6 +135,7 @@ class AccountMoveLine(models.Model): # create the sale lines in batch new_sale_lines = self.env['sale.order.line'].create(sale_line_values_to_create) + new_sale_lines._onchange_discount() # build result map by replacing index with newly created record of sale.order.line result = {}