From 4ca7b89b315c0a22f5aba0acef0205a345e397e6 Mon Sep 17 00:00:00 2001 From: Adrien Peiffer Date: Mon, 11 Jul 2022 15:03:24 +0000 Subject: [PATCH] [FIX] sale: avoid creating analytic lines for section & notes. Currently, When we create an invoice from a sale order containing some notes or sections. The analytic account from the sale order is set on the invoice/move line. During the creation of analytic lines, a line is created from the section/note line. This commit makes no analytic line is created for section/notes. closes odoo/odoo#100989 X-original-commit: a1bff32113bb0b551cd62efea5030c8f3bd4d1de Signed-off-by: Victor Feyens (vfe) --- addons/sale/models/sale_order_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/models/sale_order_line.py b/addons/sale/models/sale_order_line.py index 9136d2c7e70..ad6893ad1ed 100644 --- a/addons/sale/models/sale_order_line.py +++ b/addons/sale/models/sale_order_line.py @@ -1079,7 +1079,7 @@ class SaleOrderLine(models.Model): 'is_downpayment': self.is_downpayment, } analytic_account_id = self.order_id.analytic_account_id.id - if analytic_account_id: + if analytic_account_id and not self.display_type: res['analytic_distribution'] = res['analytic_distribution'] or {} if self.analytic_distribution: res['analytic_distribution'][analytic_account_id] = self.analytic_distribution.get(analytic_account_id, 0) + 100