From d0cbd2a06d7408306be5c559bb7202f5dd733158 Mon Sep 17 00:00:00 2001 From: Katherine Zaoral Date: Mon, 3 Feb 2020 14:41:54 +0000 Subject: [PATCH] [FIX] account: be able to found the proper transfer account Properly set the transfer account in the company taking account the accounts defined in th company domain. We found this error because in l10n_ar module we have 3 chart of accounts based on the company AFIP responsability which actually have same transfer_account_code_prefix. For that reason it was setting a transfer account to the company which is not belongs to the current company. closes odoo/odoo#44586 X-original-commit: d38228836b8944740f04ca355c997c4b6a346e48 Signed-off-by: Josse Colpaert --- 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 6dd67e8fce5..c79687d06db 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -251,7 +251,8 @@ class AccountChartTemplate(models.Model): }) # Set the transfer account on the company - company.transfer_account_id = self.env['account.account'].search([('code', '=like', self.transfer_account_code_prefix + '%')])[:1] + company.transfer_account_id = self.env['account.account'].search([ + ('code', '=like', self.transfer_account_code_prefix + '%'), ('company_id', '=', company.id)]) # Create Bank journals self._create_bank_journals(company, acc_template_ref)