summaryrefslogtreecommitdiff
path: root/addons/web/controllers
diff options
context:
space:
mode:
authorRaphael Collet <rco@openerp.com>2016-08-05 12:42:00 +0200
committerRaphael Collet <rco@openerp.com>2016-08-31 17:21:55 +0200
commit16696b2a05529a7cd3d4b9e20ee89a575f3cd9e2 (patch)
treef9a16a07f8858f83985a60562f270993363028f3 /addons/web/controllers
parent604a1c5fcd00674e841f073570979c4c6e5ab621 (diff)
[FIX] openerp, web: make `execute` and `call_kw` invoke methods in the new API
Also refactor the test to prevent private methods to be remotely called.
Diffstat (limited to 'addons/web/controllers')
-rw-r--r--addons/web/controllers/main.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index b479f6d97a9..3fcd074aeb0 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -27,7 +27,7 @@ from cStringIO import StringIO
import odoo
import odoo.modules.registry
-from odoo.api import Environment
+from odoo.api import call_kw, Environment
from odoo.modules import get_resource_path
from odoo.tools import topological_sort
from odoo.tools.translate import _
@@ -35,6 +35,7 @@ from odoo.tools.misc import str2bool, xlwt
from odoo import http
from odoo.http import request, serialize_exception as _serialize_exception, content_disposition
from odoo.exceptions import AccessError
+from odoo.models import check_method_name
_logger = logging.getLogger(__name__)
@@ -840,10 +841,8 @@ class DataSet(http.Controller):
return self._call_kw(model, method, args, {})
def _call_kw(self, model, method, args, kwargs):
- if method.startswith('_'):
- raise AccessError(_("Underscore prefixed methods cannot be remotely called"))
-
- return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
+ check_method_name(method)
+ return call_kw(request.env[model], method, args, kwargs)
@http.route('/web/dataset/call', type='json', auth="user")
def call(self, model, method, args, domain_id=None, context_id=None):