diff --git a/crm_security_group/__manifest__.py b/crm_security_group/__manifest__.py index 7d171eb69fa..c51ecf41b60 100644 --- a/crm_security_group/__manifest__.py +++ b/crm_security_group/__manifest__.py @@ -3,7 +3,7 @@ { "name": "CRM Only Security Groups", "summary": "Add new group in Sales to show only CRM", - "version": "14.0.1.1.0", + "version": "12.0.1.0.0", "category": "Customer Relationship Management", "website": "https://github.com/OCA/crm", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/crm_security_group/security/ir.model.access.csv b/crm_security_group/security/ir.model.access.csv index d77802ef470..b8a606882f0 100644 --- a/crm_security_group/security/ir.model.access.csv +++ b/crm_security_group/security/ir.model.access.csv @@ -3,7 +3,3 @@ access_crm_lead_user,crm.lead.user,crm.model_crm_lead,crm_security_group.group_c access_crm_team_user,crm.team.user,sales_team.model_crm_team,crm_security_group.group_crm_own_leads,1,0,0,0 access_crm_team_manager,crm.team.manager,sales_team.model_crm_team,crm_security_group.group_crm_own_leads,1,1,1,1 access_crm_stage_manager,crm.stage.manager,crm.model_crm_stage,crm_security_group.group_crm_manager,1,1,1,1 -access_crm_tag_own_leads,sale_team.crm.tag.own.leads,sales_team.model_crm_tag,crm_security_group.group_crm_own_leads,1,1,1,0 -access_crm_tag_manager,sale_team.crm.tag.manager,sales_team.model_crm_tag,crm_security_group.group_crm_manager,1,1,1,1 -access_crm_lead_scoring_frequency_user,crm.lead.scoring.frequency.user,crm.model_crm_lead_scoring_frequency,crm_security_group.group_crm_own_leads,1,0,0,0 -access_crm_lead_scoring_frequency_field_user,crm.lead.scoring.frequency.field.user,crm.model_crm_lead_scoring_frequency_field,crm_security_group.group_crm_own_leads,1,0,0,0 diff --git a/crm_security_group/tests/test_crm_security.py b/crm_security_group/tests/test_crm_security.py index 7104808a1c0..10a52681224 100644 --- a/crm_security_group/tests/test_crm_security.py +++ b/crm_security_group/tests/test_crm_security.py @@ -61,64 +61,64 @@ def setUpClass(cls): ) def test_user_crm_only(self): - model = self.model_ir_ui_menu.with_user(self.crm_user) + model = self.model_ir_ui_menu.sudo(self.crm_user) items = model._visible_menu_ids() self.assertTrue(self.crm_menu.id in items) self.assertFalse(self.sale_menu.id in items) # Crm lead checks - crm_lead_model = self.env["crm.lead"].with_user(self.crm_user) + crm_lead_model = self.env["crm.lead"].sudo(self.crm_user) crm_lead = crm_lead_model.browse(self.crm_lead.id) self.assertEqual(crm_lead, self.crm_lead) with self.assertRaises(AccessError): - self.crm_lead.with_user(self.crm_user).unlink() + self.crm_lead.sudo(self.crm_user).unlink() crm_lead_form = Form(crm_lead_model) crm_lead_form.name = "Lead" crm_lead_form.save() def test_user_sale(self): - model = self.model_ir_ui_menu.with_user(self.sale_user) + model = self.model_ir_ui_menu.sudo(self.sale_user) items = model._visible_menu_ids() self.assertFalse(self.crm_menu.id in items) self.assertTrue(self.sale_menu.id in items) # Crm lead checks - crm_lead_model = self.env["crm.lead"].with_user(self.sale_user) + crm_lead_model = self.env["crm.lead"].sudo(self.sale_user) crm_lead = crm_lead_model.browse(self.crm_lead.id) self.assertEqual(crm_lead, self.crm_lead) with self.assertRaises(AccessError): - self.crm_lead.with_user(self.sale_user).unlink() + self.crm_lead.sudo(self.sale_user).unlink() crm_lead_form = Form(crm_lead_model) crm_lead_form.name = "Lead" crm_lead_form.save() # Sale order checks - sale_order_model = self.env["sale.order"].with_user(self.sale_user) + sale_order_model = self.env["sale.order"].sudo(self.sale_user) sale_order = sale_order_model.browse(self.sale_order.id) self.assertEqual(sale_order, self.sale_order) with self.assertRaises(AccessError): - self.sale_order.with_user(self.sale_user).unlink() + self.sale_order.sudo(self.sale_user).unlink() sale_order_form = Form(sale_order_model) sale_order_form.partner_id = self.partner sale_order_form.save() def test_user_crm_sale(self): - model = self.model_ir_ui_menu.with_user(self.crm_sale_user) + model = self.model_ir_ui_menu.sudo(self.crm_sale_user) items = model._visible_menu_ids() self.assertTrue(self.crm_menu.id in items) self.assertTrue(self.sale_menu.id in items) # Crm lead checks - crm_lead_model = self.env["crm.lead"].with_user(self.crm_sale_user) + crm_lead_model = self.env["crm.lead"].sudo(self.crm_sale_user) crm_lead = crm_lead_model.browse(self.crm_lead.id) self.assertEqual(crm_lead, self.crm_lead) with self.assertRaises(AccessError): - self.crm_lead.with_user(self.crm_sale_user).unlink() + self.crm_lead.sudo(self.crm_sale_user).unlink() crm_lead_form = Form(crm_lead_model) crm_lead_form.name = "Lead" crm_lead_form.save() # Sale order checks - sale_order_model = self.env["sale.order"].with_user(self.crm_sale_user) + sale_order_model = self.env["sale.order"].sudo(self.crm_sale_user) sale_order = sale_order_model.browse(self.sale_order.id) self.assertEqual(sale_order, self.sale_order) with self.assertRaises(AccessError): - self.sale_order.with_user(self.crm_sale_user).unlink() + self.sale_order.sudo(self.crm_sale_user).unlink() sale_order_form = Form(sale_order_model) sale_order_form.partner_id = self.partner sale_order_form.save()