[FIX] account: Invoice line account updated incorrectly

Steps to reproduce the bug:

- Let's consider the customer invoice journal J with the default credit account A1
- Let's consider a customer invoice I with one line L1
- On L1 is set account A2 and product P1
- Import on I a new line L2 with account A3 and product P2

Bug:

The account of L1 was changed by A1 instead of keeping A2

opw:2230808

closes odoo/odoo#49582

X-original-commit: 115a18a1cdecdc6d76920efdf323fb91f2f408ee
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2020-04-15 10:22:36 +00:00
parent 6c3ddc3ad0
commit 71f1b34490
+1 -1
View File
@@ -1584,7 +1584,7 @@ class AccountMove(models.Model):
# Shortcut to load the demo data.
# Doing line.account_id triggers a default_get(['account_id']) that could returns a result.
# A section / note must not have an account_id set.
if not line._cache.get('account_id') and not line.display_type:
if not line._cache.get('account_id') and not line.display_type and not line._origin:
line.account_id = line._get_computed_account()
if not line.account_id:
if self.is_sale_document(include_receipts=True):