From ff6433242416b893d3bbc8cf2e0a9570431b7fd6 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Fri, 17 Jul 2020 10:30:22 +0000 Subject: [PATCH] [FIX] account: No account on invoice lines Create a product category with no accounts defined Create a product [DEMO] in such category with no account defined Create an invoice with the default journal which will have the default account Create an invoice line with [DEMO] Upon selecting the product the default account taken from the journal get cleared and there will be no replacement. Since the account field is mandatory the account should be preserved opw-2299228 closes odoo/odoo#54751 X-original-commit: f4c41997cfd560ded6d387324e5dbcf1b7183a36 Signed-off-by: Laurent Smet --- addons/account/models/account_move.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index ac05718161b..85a9266b615 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2963,10 +2963,10 @@ class AccountMoveLine(models.Model): accounts = self.product_id.product_tmpl_id.get_product_accounts(fiscal_pos=fiscal_position) if self.move_id.is_sale_document(include_receipts=True): # Out invoice. - return accounts['income'] + return accounts['income'] or self.account_id elif self.move_id.is_purchase_document(include_receipts=True): # In invoice. - return accounts['expense'] + return accounts['expense'] or self.account_id def _get_computed_taxes(self): self.ensure_one()