Skip to content

Commit

Permalink
[BKP][ADD]rpc_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillemCForgeFlow committed Nov 8, 2024
1 parent d97b0a0 commit 840def4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion rpc_helper/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Disable RPC",
"summary": """Helpers for disabling RPC calls""",
"version": "14.0.1.2.0",
"version": "13.0.1.0.0",
"development_status": "Beta",
"license": "LGPL-3",
"website": "https://github.com/OCA/server-tools",
Expand Down
4 changes: 2 additions & 2 deletions rpc_helper/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def protected__execute_cr(cr, uid, obj, method, *args, **kw):
odoo.api.Environment.reset() # clean cache etc if we retry the same transaction
recs = odoo.api.Environment(cr, uid, {}).get(obj)
if recs is None:
raise UserError(_("Object %s doesn't exist", obj))
raise UserError(_("Object %s doesn't exist") % obj)
# custom code starts here
if not _rpc_allowed(recs, method):
raise UserError(_("RPC call on %s is not allowed", obj))
raise UserError(_("RPC call on %s is not allowed") % obj)
return protected__execute_cr._orig__execute_cr(cr, uid, obj, method, *args, **kw)


Expand Down
1 change: 1 addition & 0 deletions rpc_helper/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* Simone Orsi <[email protected]>
* Guillem Casassas <[email protected]>
9 changes: 4 additions & 5 deletions rpc_helper/tests/test_xmlrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@


@common.tagged("post_install", "-at_install")
class TestXMLRPC(common.HttpSavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.admin_uid = cls.env.ref("base.user_admin").id
class TestXMLRPC(common.HttpCase):
def setUp(self):
super().setUp()
self.admin_uid = self.env.ref("base.user_admin").id

def _set_disable(self, val):
type(self.env["res.partner"])._disable_rpc = val
Expand Down
6 changes: 3 additions & 3 deletions rpc_helper/views/ir_model_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
<field name="model">ir.model</field>
<field name="inherit_id" ref="base.view_model_form" />
<field name="arch" type="xml">
<xpath expr="//notebook/page[@name='views']" position="after">
<xpath expr="//field[@name='view_ids']/.." position="after">
<page name="rpc_config" string="RPC config">
<field
<field
name="rpc_config_edit"
groups="base.group_no_one"
widget="ace"
groups="base.group_no_one"
/>
</page>
</xpath>
Expand Down

0 comments on commit 840def4

Please sign in to comment.