Skip to content
Permalink
Browse files

Merge pull request #143 from Ommo73/12.0-res_users_clear_access_right…

…s-port

⬆️1️⃣2️⃣ res_users_clear_access_rights *Port*
  • Loading branch information...
itpp-bot committed Aug 8, 2019
2 parents 018721a + b71f963 commit ab8179b7bd4b894a1af7b4da76cfd9d0353c89b0
@@ -1,6 +1,6 @@
==========================
Clear access rights button
==========================
============================
Clear access rights button
============================

There is an inheritance in access right groups. Some time you try untick something,
but after clicking "Save" button you get tick back.
@@ -21,6 +21,6 @@ Sponsors
Further information
===================

HTML Description: https://apps.odoo.com/apps/modules/9.0/res_users_clear_access_rights/
HTML Description: https://apps.odoo.com/apps/modules/12.0/res_users_clear_access_rights/

Tested on Odoo 9.0 2ec9a9c99294761e56382bdcd766e90b8bc1bb38
Tested on Odoo 12.0 e7cf0b4d61a167952554827b90672de90c3caf2e
@@ -1,7 +1,7 @@
{
'name': 'Clear access rights button',
"summary": """Useful tool to reset user rights""",
'version': '1.0.0',
'version': '12.0.1.1.0',
'author': 'IT-Projects LLC, Ivan Yelizariev',
'license': 'LGPL-3',
"support": "apps@it-projects.info",
@@ -14,6 +14,6 @@
],
"demo": [
],
'installable': False,
'installable': True,
'auto_install': False,
}
@@ -0,0 +1,9 @@
`1.1.0`
-------

- **New**: does not clear user type when clear access rights

`1.0.0`
-------

- Init version
@@ -0,0 +1,8 @@
============================
Clear access rights button
============================

Installation
============

* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way
@@ -1,4 +1,4 @@
from openerp import models, api
from odoo import models, api


class ResUsers(models.Model):
@@ -13,10 +13,17 @@ def action_clear_access_rights(self):
self.env.ref('base.group_system').id,
]

user_types = [
self.env.ref('base.group_portal').id,
self.env.ref('base.group_public').id,
self.env.ref('base.group_user').id,
]

groups_id = []
for g in self.groups_id:
if self.env.uid == self.id and g.id in admin_groups:
if self.env.uid == self.id and g.id in admin_groups or g.id in user_types:
# don't allow for Administrator to clear his admin rights
# don't clear user type
continue
groups_id.append((3, g.id))
self.write({'groups_id': groups_id})
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>

<record id="view_users_form" model="ir.ui.view">
<field name="name">res.users.form</field>
<field name="model">res.users</field>
@@ -14,5 +14,5 @@
</field>

</record>
</data>
</openerp>

</odoo>

0 comments on commit ab8179b

Please sign in to comment.
You can’t perform that action at this time.