How to reproduce the problem:
- Install the purchase_requistion, purchase_requistion_stock, and any Localization modules such as l10n_be or l10n_in
(apart from USD currency any localization module)
- error caught only when at the time of module installation but it must have a different currency_id apart from USD
https://watch.screencastify.com/v/1C7GQKHBASyiluGGkFfV
Cause of the problem:
static values Currency USD cause the problem.
the following module will be set the currency value
l10n_be - EUR
l10n_in - INR
l10n_br - BRL
when we installed the following modules then cls.env.user.company_id.currency_id values get changes accordingly
will lead to this error
Traceback (most recent call last):
File /home/odoo/src/odoo/addons/purchase_requisition/tests/common.py, line 70, in setUpClass
cls.env.user.company_id.currency_id = cls.env.ref(base.USD).id
File /home/odoo/src/odoo/odoo/fields.py, line 1217, in __set__
records.write({self.name: write_value})
File /home/odoo/src/odoo/addons/account/models/company.py, line 301, in write
raise UserError(_('You cannot change the currency of the company since some journal items already exist'))
odoo.exceptions.UserError: You cannot change the currency of the company since some journal items already exist
opw-2945581
closesodoo/odoo#98512
Closes: https://github.com/odoo/odoo/pull/98174
X-original-commit: 70b7c57f7ea0a619a149461e0e738ddc25b822f6
Signed-off-by: William Henrotin (whe) <whe@odoo.com>