Skip to content

Commit 41a40aa

Browse files
[RFR] Explicit access rights so that tests can run
Fixes OCA#505
1 parent 9a97968 commit 41a40aa

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

database_cleanup/README.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Usage
2020
=====
2121

2222
After installation of this module, go to the Settings menu -> Technical ->
23-
Database cleanup. Go through the modules, models, columns and tables
23+
Database cleanup. This menu is only available to members of the *Access Rights*
24+
group. Go through the modules, models, columns and tables
2425
entries under this menu (in that order) and find out if there is orphaned data
2526
in your database. You can either delete entries by line, or sweep all entries
2627
in one big step (if you are *really* confident).

database_cleanup/models/purge_wizard.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def purge(self):
2424
@api.model
2525
def create(self, values):
2626
# make sure the user trying this is actually supposed to do it
27-
if not self.env.ref('database_cleanup.menu_database_cleanup')\
28-
.parent_id._filter_visible_menus():
27+
if self.env.ref(
28+
'base.group_erp_manager') not in self.env.user.groups_id:
2929
raise AccessDenied
3030
return super(CleanupPurgeLine, self).create(values)
3131

@@ -86,8 +86,8 @@ def name_get(self):
8686
@api.model
8787
def create(self, values):
8888
# make sure the user trying this is actually supposed to do it
89-
if not self.env.ref('database_cleanup.menu_database_cleanup')\
90-
.parent_id._filter_visible_menus():
89+
if self.env.ref(
90+
'base.group_erp_manager') not in self.env.user.groups_id:
9191
raise AccessDenied
9292
return super(PurgeWizard, self).create(values)
9393

database_cleanup/views/menu.xml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<field name="sequence" eval="10" />
88
<!-- attach to Settings -> Technical -->
99
<field name="parent_id" ref="base.menu_custom"/>
10+
<field name="groups_id" eval="[(6,0, [ref('base.group_erp_manager')])]"/>
1011
</record>
1112

1213
<record model="ir.ui.menu" id="menu_purge_modules">

0 commit comments

Comments
 (0)