[FIX] purchase_requisition,purchase_requisition_stock: Fix Test case
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 closes odoo/odoo#98512 Closes: https://github.com/odoo/odoo/pull/98174 X-original-commit: 70b7c57f7ea0a619a149461e0e738ddc25b822f6 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
@@ -66,4 +66,3 @@ class TestPurchaseRequisitionCommon(common.TransactionCase):
|
||||
cls.res_partner_1 = cls.env['res.partner'].create({
|
||||
'name': 'Wood Corner',
|
||||
})
|
||||
cls.env.user.company_id.currency_id = cls.env.ref("base.USD").id
|
||||
|
||||
@@ -58,7 +58,7 @@ class TestPurchaseRequisitionStock(TestPurchaseRequisitionCommon):
|
||||
'line_ids': [line1],
|
||||
'type_id': requisition_type.id,
|
||||
'vendor_id': vendor2.id,
|
||||
'currency_id': self.env.ref("base.USD").id,
|
||||
'currency_id': self.env.user.company_id.currency_id.id,
|
||||
})
|
||||
requisition_blanket.action_in_progress()
|
||||
|
||||
@@ -144,13 +144,13 @@ class TestPurchaseRequisitionStock(TestPurchaseRequisitionCommon):
|
||||
'line_ids': [line1],
|
||||
'type_id': requisition_type.id,
|
||||
'vendor_id': vendor1.id,
|
||||
'currency_id': self.env.ref("base.USD").id,
|
||||
'currency_id': self.env.user.company_id.currency_id.id,
|
||||
})
|
||||
requisition_2 = self.env['purchase.requisition'].create({
|
||||
'line_ids': [line2],
|
||||
'type_id': requisition_type.id,
|
||||
'vendor_id': vendor1.id,
|
||||
'currency_id': self.env.ref("base.USD").id,
|
||||
'currency_id': self.env.user.company_id.currency_id.id,
|
||||
})
|
||||
requisition_1.action_in_progress()
|
||||
requisition_2.action_in_progress()
|
||||
|
||||
Reference in New Issue
Block a user