From 30fd0071a23d6dc7ba65c2e5728d1c821e03bc39 Mon Sep 17 00:00:00 2001 From: Alvaro Fuentes Date: Mon, 12 Jun 2023 11:53:15 +0000 Subject: [PATCH] [FIX] account: use more efficient method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check accounting entries in a more effective way. closes odoo/odoo#124755 X-original-commit: 316c1d9745af33d85bd94747b3d913d9c9db2342 Signed-off-by: William André (wan) Signed-off-by: Alvaro Fuentes Suarez (afu) --- addons/account/models/company.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 44667e857cb..f4708dd6656 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -401,7 +401,7 @@ class ResCompany(models.Model): #forbid the change of currency_id if there are already some accounting entries existing if 'currency_id' in values and values['currency_id'] != company.currency_id.id: - if self.env['account.move.line'].search([('company_id', '=', company.id)]): + if company._existing_accounting(): raise UserError(_('You cannot change the currency of the company since some journal items already exist')) return super(ResCompany, self).write(values)