Skip to content

Commit

Permalink
[FIX] account: use more efficient method
Browse files Browse the repository at this point in the history
Check accounting entries in a more effective way.

closes odoo#124755

X-original-commit: 316c1d9
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Alvaro Fuentes Suarez (afu) <afu@odoo.com>
  • Loading branch information
aj-fuentes committed Jun 13, 2023
1 parent 8bcca1a commit 30fd007
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/account/models/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def write(self, values):

#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)
Expand Down

0 comments on commit 30fd007

Please sign in to comment.