[14.0][MIG] base_model_restrict_update
parent
0fe58b9967
commit
b70360140d
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
* Quartile Limited
|
||||
|
||||
* Yoshi Tashiro <tashiro@quartile.co>
|
||||
|
||||
* Ecosoft
|
||||
|
||||
* Kitti U. <kittiu@ecosoft.co.th>
|
Loading…
Reference in New Issue