diff --git a/product_state/security/ir.model.access.csv b/product_state/security/ir.model.access.csv index 742e0231611..523e15ff1e8 100644 --- a/product_state/security/ir.model.access.csv +++ b/product_state/security/ir.model.access.csv @@ -1,3 +1,4 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_product_state_product_manager","product.state","model_product_state","base.group_partner_manager",1,1,1,1 +"access_product_state_sale_manager","product.state","model_product_state","sales_team.group_sale_manager",1,1,1,1 +"access_product_state_stock_manager","product.state","model_product_state","stock.group_stock_manager",1,1,1,1 "access_product_state_public","product.state.public","model_product_state",,1,0,0,0 diff --git a/product_status/tests/test_product_status.py b/product_status/tests/test_product_status.py index 13069c0478b..ab1f4f7577d 100644 --- a/product_status/tests/test_product_status.py +++ b/product_status/tests/test_product_status.py @@ -120,7 +120,8 @@ def test_template_state_dates(self): def test_modified_default_data(self): st_env = self.env["product.state"] - demo_user = self.env.ref("base.user_demo").id + demo_user = self.env.ref("base.user_demo") + demo_user.groups_id = [(4, self.env.ref("sales_team.group_sale_manager").id)] default_state = st_env._get_module_data() vals = { "name": "State change", @@ -131,7 +132,7 @@ def test_modified_default_data(self): for ds_id in default_state: vals["code"] = ds_id.code with self.assertRaises(ValidationError) as cm: - st_env.browse(ds_id.id).with_user(demo_user).write(vals) + st_env.browse(ds_id.id).with_user(demo_user.id).write(vals) wn_expect = cm.exception.args[0] self.assertEqual( "Cannot delete/modified state installed by module, state name: %s" @@ -139,7 +140,7 @@ def test_modified_default_data(self): wn_expect, ) with self.assertRaises(ValidationError) as cm: - st_env.browse(ds_id.id).with_user(demo_user).unlink() + st_env.browse(ds_id.id).with_user(demo_user.id).unlink() wn_expect = cm.exception.args[0] self.assertEqual( "Cannot delete/modified state installed by module, state name: %s" @@ -148,7 +149,7 @@ def test_modified_default_data(self): ) # Allow update default value current_default_state = st_env.search([("default", "=", True)]) - current_default_state = current_default_state.with_user(demo_user) + current_default_state = current_default_state.with_user(demo_user.id) for vals in [ {"default": False}, {"active": False},