[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 <jco@openerp.com>
This commit is contained in:
Katherine Zaoral
2020-02-04 12:25:39 +00:00
parent e4e84196f6
commit d0cbd2a06d
+2 -1
View File
@@ -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)