diff --git a/addons/account/models/account.py b/addons/account/models/account.py index ef611962da9..6ceb5ba19b1 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -167,6 +167,12 @@ class AccountAccount(models.Model): move_lines = self.env['account.move.line'].search([('account_id', 'in', self.ids)], limit=1) if len(move_lines): raise UserError(_('You cannot change the value of the reconciliation on this account as it already has some moves')) + + if vals.get('currency_id'): + for account in self: + if self.env['account.move.line'].search_count([('account_id', '=', account.id), ('currency_id', 'not in', (False, vals['currency_id']))]): + raise UserError(_('You cannot set a currency on this account as it already has some journal entries having a different foreign currency.')) + return super(AccountAccount, self).write(vals) @api.multi