From 4eb1cb2fd7b546f673aa11eb1915842a87dd0ea8 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Mon, 1 Mar 2021 16:56:42 +0000 Subject: [PATCH] [FIX] account: Fix always set currency_id on aml with populate Since 14.0, 'currency_id' and 'amount_currency' should always be filled when creating account.move.lines. X-original-commit: 7827875271adafbfc656fe09c87e37e7d1a3802f --- addons/account/populate/account_move.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/account/populate/account_move.py b/addons/account/populate/account_move.py index e96811a921f..91bd1459dad 100644 --- a/addons/account/populate/account_move.py +++ b/addons/account/populate/account_move.py @@ -96,10 +96,7 @@ class AccountMove(models.Model): :return list: list of ORM create commands for the field line_ids """ def get_line(account, label, balance=None, balance_sign=False, exclude_from_invoice_tab=False): - is_foreign_currency = ( - currency_id != account.currency_id.id - and currency_id != account.company_id.currency_id.id - ) + is_foreign_currency = currency_id != account.company_id.currency_id.id balance = balance or balance_sign * round(random.uniform(0, 1000)) return (0, 0, { 'name': 'label_%s' % label, @@ -107,8 +104,8 @@ class AccountMove(models.Model): 'credit': balance < 0 and -balance or 0, 'account_id': account.id, 'partner_id': partner_id, - 'currency_id': currency_id if is_foreign_currency else False, - 'amount_currency': 2 * balance if is_foreign_currency else False, + 'currency_id': currency_id, + 'amount_currency': 2 * balance if is_foreign_currency else balance, 'exclude_from_invoice_tab': exclude_from_invoice_tab, }) move_type = values['move_type']