summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorAndrea Grazioso (agr-odoo) <agr@odoo.com>2020-07-17 10:30:22 +0000
committerAndrea Grazioso (agr-odoo) <agr@odoo.com>2020-07-22 09:37:07 +0000
commitff6433242416b893d3bbc8cf2e0a9570431b7fd6 (patch)
tree5096d4177e17e94c839a49e405c693b907a4e4e8 /addons
parent3922182c97c5f2a889b31c1ebe90630d6838349f (diff)
[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 <smetl@users.noreply.github.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/account/models/account_move.py4
1 files 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()