From 53d41e70285f0d1c0a89fbb434443e8850328ecc Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 26 Jun 2023 14:11:48 +0000 Subject: [PATCH] [FIX] account: we need to find back xml_id in existing accounts instead of browsing directly Before, when instantiating the taxes for France in a Belgian company through a French fiscal position (multi-vat), a traceback would be shown because the cash based transition account would not be retrieved in the correct way. By checking the existing accounts (which are created on the fly for multi-vat) instead of browsing the record and also, by allowing no account at all, we avoid tracebacks and the taxes get created. closes odoo/odoo#126473 X-original-commit: 85f45e37c4ad9503dcc96c321d26504bce3de2c0 Signed-off-by: Brice Bartoletti (bib) --- addons/account/models/chart_template.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 303afba42bc..617042bb83b 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -730,9 +730,10 @@ class AccountChartTemplate(models.AbstractModel): account_id = [rep_line['account_id'] for _command, _id, rep_line in tax_template['repartition_line_ids'] if rep_line.get('account_id')] if account_id: - local_account = self.env['account.account'].browse(account_id[0]) + local_account = self.env['account.account'].browse(existing_accounts[account_id[0]]) existing_accounts[account_xml_id] = create_foreign_tax_account(local_account, _("Cash basis transition account")).id continue + existing_accounts[account_xml_id] = None # Assign the account based on the map for field, account_name in field_and_names: