diff --git a/rpc_helper/README.rst b/rpc_helper/README.rst index 28dc4b3e458..4e6003c25ba 100644 --- a/rpc_helper/README.rst +++ b/rpc_helper/README.rst @@ -54,7 +54,7 @@ To disable all calls: :: { - "disable": ["all"], + "disable": ["all"] } To disable only some methods: @@ -62,7 +62,7 @@ To disable only some methods: :: { - "disable": ["create", "write", "another_method"], + "disable": ["create", "write", "another_method"] } NOTE: on the resulting JSON will be automatically formatted on save for @@ -122,6 +122,16 @@ Contributors - Simone Orsi +Trobz + +- Tuan Nguyen + +Other credits +------------- + +The migration of this module from 16.0 to 18.0 was financially supported +by Camptocamp. + Maintainers ----------- diff --git a/rpc_helper/__manifest__.py b/rpc_helper/__manifest__.py index b20a92031cd..eed0c691686 100644 --- a/rpc_helper/__manifest__.py +++ b/rpc_helper/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Disable RPC", "summary": """Helpers for disabling RPC calls""", - "version": "16.0.1.0.0", + "version": "18.0.1.0.0", "development_status": "Beta", "license": "LGPL-3", "website": "https://github.com/OCA/server-tools", diff --git a/rpc_helper/patch.py b/rpc_helper/patch.py index c3a05691b9b..419b65d6963 100644 --- a/rpc_helper/patch.py +++ b/rpc_helper/patch.py @@ -4,18 +4,18 @@ import odoo from odoo.exceptions import UserError -from odoo.tools.translate import _ def protected__execute_cr(cr, uid, obj, method, *args, **kw): # Same as original func in odoo.service.model.execute_cr cr.reset() - recs = odoo.api.Environment(cr, uid, {}).get(obj) + env = odoo.api.Environment(cr, uid, {}) + recs = env.get(obj) if recs is None: - raise UserError(_("Object %s doesn't exist", obj)) + raise UserError(env._("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(env._("RPC call on %s is not allowed", obj)) return protected__execute_cr._orig__execute_cr(cr, uid, obj, method, *args, **kw) diff --git a/rpc_helper/readme/CONFIGURE.md b/rpc_helper/readme/CONFIGURE.md index f50dcfd1af9..a0d3a24f8b6 100644 --- a/rpc_helper/readme/CONFIGURE.md +++ b/rpc_helper/readme/CONFIGURE.md @@ -13,13 +13,13 @@ difference is that you have to wrap values in a dictionary like To disable all calls: { - "disable": ["all"], + "disable": ["all"] } To disable only some methods: { - "disable": ["create", "write", "another_method"], + "disable": ["create", "write", "another_method"] } NOTE: on the resulting JSON will be automatically formatted on save for diff --git a/rpc_helper/readme/CONTRIBUTORS.md b/rpc_helper/readme/CONTRIBUTORS.md index 2b66303ae2d..db0b3806a76 100644 --- a/rpc_helper/readme/CONTRIBUTORS.md +++ b/rpc_helper/readme/CONTRIBUTORS.md @@ -1 +1,4 @@ - Simone Orsi \<\> + +Trobz +- Tuan Nguyen \<\> \ No newline at end of file diff --git a/rpc_helper/readme/CREDITS.md b/rpc_helper/readme/CREDITS.md new file mode 100644 index 00000000000..5683eba414e --- /dev/null +++ b/rpc_helper/readme/CREDITS.md @@ -0,0 +1 @@ +The migration of this module from 16.0 to 18.0 was financially supported by Camptocamp. \ No newline at end of file diff --git a/rpc_helper/static/description/index.html b/rpc_helper/static/description/index.html index 687c2a3e39b..4dfec33cda3 100644 --- a/rpc_helper/static/description/index.html +++ b/rpc_helper/static/description/index.html @@ -384,7 +384,8 @@

Disable RPC

  • Credits
  • @@ -401,13 +402,13 @@

    Configuration

    To disable all calls:

     {
    -    "disable": ["all"],
    +    "disable": ["all"]
     }
     

    To disable only some methods:

     {
    -    "disable": ["create", "write", "another_method"],
    +    "disable": ["create", "write", "another_method"]
     }
     

    NOTE: on the resulting JSON will be automatically formatted on save for @@ -459,9 +460,18 @@

    Contributors

    +

    Trobz

    + + +
    +

    Other credits

    +

    The migration of this module from 16.0 to 18.0 was financially supported +by Camptocamp.