Skip to content

Commit

Permalink
product_state: move access to Sales + Inventory Manager
Browse files Browse the repository at this point in the history
  • Loading branch information
aleuffre authored and henrybackman committed Nov 11, 2024
1 parent 4c99f3a commit 2238230
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion product_state/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -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
9 changes: 5 additions & 4 deletions product_status/tests/test_product_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -131,15 +132,15 @@ 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"
% (ds_id.name),
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"
Expand All @@ -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},
Expand Down

0 comments on commit 2238230

Please sign in to comment.