diff --git a/base_model_restrict_update/__manifest__.py b/base_model_restrict_update/__manifest__.py index 6e52e666e..27f9057fc 100644 --- a/base_model_restrict_update/__manifest__.py +++ b/base_model_restrict_update/__manifest__.py @@ -2,7 +2,7 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). { "name": "Update Restrict Model", - "version": "12.0.1.0.0", + "version": "14.0.1.0.0", "depends": ["base"], "website": "https://github.com/OCA/server-tools", "author": "Odoo Community Association (OCA), Quartile Limited", diff --git a/base_model_restrict_update/models/ir_model_access.py b/base_model_restrict_update/models/ir_model_access.py index f6d7e0e89..e5da3aa46 100644 --- a/base_model_restrict_update/models/ir_model_access.py +++ b/base_model_restrict_update/models/ir_model_access.py @@ -14,13 +14,13 @@ class IrModelAccess(models.Model): "self._uid", "model", "mode", "raise_exception", keys=("lang",) ) def check(self, model, mode="read", raise_exception=True): - res = super(IrModelAccess, self).check(model, mode, raise_exception) - if self._uid == 1: + if self.env.su: return True + res = super().check(model, mode, raise_exception) self._cr.execute( "SELECT restrict_update FROM ir_model WHERE model = %s", (model,) ) - query_res = self._cr.dictfetchall()[0] + query_res = self._cr.dictfetchone() if ( query_res["restrict_update"] and mode != "read" diff --git a/base_model_restrict_update/models/res_users.py b/base_model_restrict_update/models/res_users.py index 053ed6e59..0c3ce733d 100644 --- a/base_model_restrict_update/models/res_users.py +++ b/base_model_restrict_update/models/res_users.py @@ -1,7 +1,7 @@ # Copyright 2021 Quartile Limited # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -from odoo import api, fields, models +from odoo import fields, models class ResUsers(models.Model): @@ -12,7 +12,6 @@ class ResUsers(models.Model): help="Set to true and the user can update restricted model.", ) - @api.multi def toggle_unrestrict_model_update(self): for record in self: record.unrestrict_model_update = not record.unrestrict_model_update diff --git a/base_model_restrict_update/readme/CONTRIBUTORS.rst b/base_model_restrict_update/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..6a2d7b3a9 --- /dev/null +++ b/base_model_restrict_update/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* Quartile Limited + + * Yoshi Tashiro + +* Ecosoft + + * Kitti U.