[FIX] mrp: tests with Form on 'mrp.production'
Add the group 'mrp.group_mrp_routings' on the main user to make field 'workorder_ids' visible in the form view of 'mrp.production'. Many tests use that view, and require the subviews of that field to be present in order to create records. closes odoo/odoo#116779 Related: odoo/enterprise#38858 Related: odoo/documentation#3968 Signed-off-by: Raphael Collet <rco@odoo.com>
This commit is contained in:
@@ -93,9 +93,11 @@ class TestMrpCommon(common2.TestStockCommon):
|
||||
notification_type='inbox',
|
||||
groups='mrp.group_mrp_manager, stock.group_stock_user, mrp.group_mrp_byproducts, uom.group_uom',
|
||||
)
|
||||
# Required for `product_uom_id` to be visible in the view
|
||||
# This class is used by a lot of tests which sets `product_uom_id` on `mrp.production`
|
||||
cls.env.user.groups_id += cls.env.ref('uom.group_uom')
|
||||
# Both groups below are required to make fields `product_uom_id` and
|
||||
# `workorder_ids` to be visible in the view of `mrp.production`. The
|
||||
# field `product_uom_id` must be set by many tests, and subviews of
|
||||
# `workorder_ids` must be present in many tests to create records.
|
||||
cls.env.user.groups_id += cls.env.ref('uom.group_uom') + cls.env.ref('mrp.group_mrp_routings')
|
||||
|
||||
cls.workcenter_1 = cls.env['mrp.workcenter'].create({
|
||||
'name': 'Nuclear Workcenter',
|
||||
|
||||
@@ -9,7 +9,13 @@ class TestMrpAnalyticAccount(TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.env.user.write({'groups_id': [(4, cls.env.ref('analytic.group_analytic_accounting').id),]})
|
||||
# The group 'mrp.group_mrp_routings' is required to make the field
|
||||
# 'workorder_ids' visible in the view of 'mrp.production'. The subviews
|
||||
# of `workorder_ids` must be present in many tests to create records.
|
||||
cls.env.user.groups_id += (
|
||||
cls.env.ref('analytic.group_analytic_accounting')
|
||||
+ cls.env.ref('mrp.group_mrp_routings')
|
||||
)
|
||||
|
||||
cls.analytic_plan = cls.env['account.analytic.plan'].create({
|
||||
'name': 'Plan',
|
||||
|
||||
Reference in New Issue
Block a user