Skip to content

Commit 6255c35

Browse files
authored
Merge pull request #301 from trojikman/14.0-access_apps-fix
commit is created by 👷‍♂️ Merge Bot: https://odoo-devops.readthedocs.io/en/latest/git/github-merge-bot.html
2 parents 3c2f775 + 1f1cb88 commit 6255c35

File tree

7 files changed

+28
-10
lines changed

7 files changed

+28
-10
lines changed

access_apps/README.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ Adds **Apps access** selection in user's access rights tab. Two options are avai
1313
* *Allow installing apps*
1414
* *Allow installing apps only from settings*
1515

16-
Roadmap
17-
=======
18-
19-
* Access records (e.g. ``access_ir_module_module_group_user``) should not be deleted. It has to be disactivated and make active on uninstallation
20-
2116
Questions?
2217
==========
2318

access_apps/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from . import models
2+
from .hooks import uninstall_hook

access_apps/__manifest__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
1+
# Copyright 2018,2021 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
22
# Copyright 2018 Ildar Nasyrov <https://it-projects.info/team/iledarn>
33
# License MIT (https://opensource.org/licenses/MIT).
44
{
@@ -7,7 +7,7 @@
77
"category": "Access",
88
# "live_test_url": "",
99
"images": [],
10-
"version": "14.0.1.3.3",
10+
"version": "14.0.2.0.0",
1111
"application": False,
1212
"author": "IT-Projects LLC, Ivan Yelizariev",
1313
"support": "apps@itpp.dev",
@@ -23,7 +23,7 @@
2323
"post_load": None,
2424
"pre_init_hook": None,
2525
"post_init_hook": None,
26-
"uninstall_hook": None,
26+
"uninstall_hook": "uninstall_hook",
2727
"auto_install": False,
2828
"installable": True,
2929
}

access_apps/doc/changelog.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
`2.0.0`
2+
-------
3+
- **Fix:** restore original access rights on uninstallation
4+
- **Fix:** error in Settings menu when some modules are installed
5+
16
`1.3.3`
27
-------
38
- **Fix:** Grant `Allow installing apps` to Admin and System users (it was only System)

access_apps/hooks.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright 2021 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
2+
# License MIT (https://opensource.org/licenses/MIT).
3+
from odoo import SUPERUSER_ID, api
4+
5+
6+
def uninstall_hook(cr, registry):
7+
env = api.Environment(cr, SUPERUSER_ID, {})
8+
access = env.ref(
9+
"base.access_ir_module_module_group_user", raise_if_not_found=False
10+
)
11+
access.write({"active": True})

access_apps/models/res_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def default_get(self, fields):
3333
for name, module in classified["to_uninstall"]:
3434
res[name] = module.state in ("installed", "to install", "to upgrade")
3535
if self._fields[name].type == "selection":
36-
res[name] = int(res[name])
36+
res[name] = str(int(res[name]))
3737

3838
return res
3939

access_apps/security/access_apps_security.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2+
<!-- Copyright 2018,2021 Ivan Yelizariev <https://twitter.com/yelizariev>
3+
Copyright 2018 Ildar Nasyrov <https://it-projects.info/team/iledarn>
4+
License MIT (https://opensource.org/licenses/MIT).
5+
-->
26
<odoo>
3-
<delete id="base.access_ir_module_module_group_user" model="ir.model.access" />
7+
<record id="base.access_ir_module_module_group_user" model="ir.model.access">
8+
<field name="active" eval="False" />
9+
</record>
410
<record id="module_category_access_apps" model="ir.module.category">
511
<field name="name">Apps access</field>
612
<field name="sequence">18</field>

0 commit comments

Comments
 (0)