[FIX] account: use more efficient method
Check accounting entries in a more effective way. closes odoo/odoo#124755 X-original-commit: 316c1d9745af33d85bd94747b3d913d9c9db2342 Signed-off-by: William André (wan) <wan@odoo.com> Signed-off-by: Alvaro Fuentes Suarez (afu) <afu@odoo.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user