From e935cf9a51004aa3dff5699ad4da09c46c09d42d Mon Sep 17 00:00:00 2001
From: Josse Colpaert <jco@odoo.com>
Date: Tue, 4 Feb 2020 12:39:58 +0000
Subject: [PATCH] [FIX] account: on CoA install, need to only take the first
 transfer account
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

With the commit some time ago #d382288, I removed to take the first,
but you can have multiple transfer accounts in one company.

The best way is to just do a limit=1

closes odoo/odoo#44592

closes odoo/odoo#74072

Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: William André (wan) <wan@odoo.com>
---
 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 aed3e65aef66..da7c03528792 100644
--- a/addons/account/models/chart_template.py
+++ b/addons/account/models/chart_template.py
@@ -250,7 +250,7 @@ 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 + '%'), ('company_id', '=', company.id)])
+            ('code', '=like', self.transfer_account_code_prefix + '%'), ('company_id', '=', company.id)], limit=1)
 
         # Create Bank journals
         self._create_bank_journals(company, acc_template_ref)
-- 
GitLab