[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).
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||||
{
|
{
|
||||||
"name": "Update Restrict Model",
|
"name": "Update Restrict Model",
|
||||||
"version": "12.0.1.0.0",
|
"version": "14.0.1.0.0",
|
||||||
"depends": ["base"],
|
"depends": ["base"],
|
||||||
"website": "https://github.com/OCA/server-tools",
|
"website": "https://github.com/OCA/server-tools",
|
||||||
"author": "Odoo Community Association (OCA), Quartile Limited",
|
"author": "Odoo Community Association (OCA), Quartile Limited",
|
||||||
|
|
|
@ -14,13 +14,13 @@ class IrModelAccess(models.Model):
|
||||||
"self._uid", "model", "mode", "raise_exception", keys=("lang",)
|
"self._uid", "model", "mode", "raise_exception", keys=("lang",)
|
||||||
)
|
)
|
||||||
def check(self, model, mode="read", raise_exception=True):
|
def check(self, model, mode="read", raise_exception=True):
|
||||||
res = super(IrModelAccess, self).check(model, mode, raise_exception)
|
if self.env.su:
|
||||||
if self._uid == 1:
|
|
||||||
return True
|
return True
|
||||||
|
res = super().check(model, mode, raise_exception)
|
||||||
self._cr.execute(
|
self._cr.execute(
|
||||||
"SELECT restrict_update FROM ir_model WHERE model = %s", (model,)
|
"SELECT restrict_update FROM ir_model WHERE model = %s", (model,)
|
||||||
)
|
)
|
||||||
query_res = self._cr.dictfetchall()[0]
|
query_res = self._cr.dictfetchone()
|
||||||
if (
|
if (
|
||||||
query_res["restrict_update"]
|
query_res["restrict_update"]
|
||||||
and mode != "read"
|
and mode != "read"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright 2021 Quartile Limited
|
# Copyright 2021 Quartile Limited
|
||||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
# 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):
|
class ResUsers(models.Model):
|
||||||
|
@ -12,7 +12,6 @@ class ResUsers(models.Model):
|
||||||
help="Set to true and the user can update restricted model.",
|
help="Set to true and the user can update restricted model.",
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def toggle_unrestrict_model_update(self):
|
def toggle_unrestrict_model_update(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
record.unrestrict_model_update = not record.unrestrict_model_update
|
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