diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index 70464967077..4a1fdb752fa 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -8812,6 +8812,12 @@ msgstr "" msgid "You cannot cancel an invoice which is partially paid. You need to unreconcile related payment entries first." msgstr "" +#. module: account +#: code:addons/account/models/company.py:118 +#, python-format +msgid "You cannot change the currency of the company since some journal items already exist" +msgstr "" + #. module: account #: code:addons/account/models/account.py:162 #, python-format diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 13591c254de..5eb3e27e8b3 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from openerp import fields, models, api, _ -from openerp.exceptions import ValidationError +from openerp.exceptions import ValidationError, UserError from datetime import timedelta @@ -111,4 +111,10 @@ Best Regards,''') company.reflect_code_prefix_change(company.cash_account_code_prefix, new_cash_code, digits) if values.get('accounts_code_digits'): company.reflect_code_digits_change(digits) + + #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)]): + raise UserError(_('You cannot change the currency of the company since some journal items already exist')) + return super(ResCompany, self).write(values)