Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

30
rpc_helper/patch.py Executable file
View File

@@ -0,0 +1,30 @@
# Copyright 2022 Camptocamp SA
# @author: Simone Orsi <simone.orsi@camptocamp.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
import odoo
from odoo.exceptions import UserError
def protected__execute_cr(cr, uid, obj, method, *args, **kw):
# Same as original func in odoo.service.model.execute_cr
cr.reset()
env = odoo.api.Environment(cr, uid, {})
recs = env.get(obj)
if recs is None:
raise UserError(env._("Object %s doesn't exist", obj))
# custom code starts here
if not _rpc_allowed(recs, method):
raise UserError(env._("RPC call on %s is not allowed", obj))
return protected__execute_cr._orig__execute_cr(cr, uid, obj, method, *args, **kw)
def _rpc_allowed(recordset, method):
config = getattr(recordset, "_disable_rpc", None)
if config is None:
config = (
recordset.env["ir.model"]._get_rpc_config(recordset._name).get("disable")
)
if config is None:
return True
return "all" not in config and method not in config