From b1afea13d4fbd502fd2bbac4583b94f3e9abcc0f Mon Sep 17 00:00:00 2001 From: "Florimond Husquinet (fhu)" Date: Fri, 6 Sep 2019 11:32:39 +0000 Subject: [PATCH] [FIX] account: chart of account installation cannot find a transfer account Before this commit: For a couple of clients, the installation of a chart of accounts crashes because a transfer account is not found. This account should have been created automatically, but hasn't, or has been deleted. After this commit: If no transfer account is found, no account is linked to the "Transfer account" field of the company, but the installation doesn't crash. closes odoo/odoo#36693 Opw: 2066557 X-original-commit: d93e5c12bab233d727a6cfb519e77f5fabb73912 Signed-off-by: Nicolas Martinelli (nim) --- addons/account/models/chart_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 94f30d68177..6e639d3e896 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -230,7 +230,7 @@ class AccountChartTemplate(models.Model): acc_template_ref, taxes_ref = self._install_template(company, code_digits=self.code_digits) # Set the transfer account on the company - company.transfer_account_id = self.env['account.account'].search([('code', '=like', self.transfer_account_code_prefix + '%')])[0] + company.transfer_account_id = self.env['account.account'].search([('code', '=like', self.transfer_account_code_prefix + '%')])[:1] # Create Bank journals self._create_bank_journals(company, acc_template_ref)