diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py index 806d108f4e6..5cb20394189 100644 --- a/openerp/addons/base/ir/ir_ui_view.py +++ b/openerp/addons/base/ir/ir_ui_view.py @@ -538,26 +538,6 @@ class view(osv.osv): 'fields': xfields } attrs = {'views': views} - if node.get('widget') and node.get('widget') == 'selection': - # Prepare the cached selection list for the client. This needs to be - # done even when the field is invisible to the current user, because - # other events could need to change its value to any of the selectable ones - # (such as on_change events, refreshes, etc.) - - # If domain and context are strings, we keep them for client-side, otherwise - # we evaluate them server-side to consider them when generating the list of - # possible values - # TODO: find a way to remove this hack, by allow dynamic domains - dom = [] - if column._domain and not isinstance(column._domain, basestring): - dom = list(column._domain) - dom += eval(node.get('domain', '[]'), {'uid': user, 'time': time}) - search_context = dict(context) - if column._context and not isinstance(column._context, basestring): - search_context.update(column._context) - attrs['selection'] = relation._name_search(cr, user, '', dom, context=search_context, limit=None, name_get_uid=1) - if (node.get('required') and not int(node.get('required'))) or not column.required: - attrs['selection'].append((False, '')) fields[node.get('name')] = attrs field = model_fields.get(node.get('name')) diff --git a/openerp/http.py b/openerp/http.py index 5b49b8f22da..285bdd751d3 100644 --- a/openerp/http.py +++ b/openerp/http.py @@ -506,6 +506,13 @@ class ControllerType(type): class Controller(object): __metaclass__ = ControllerType +class EndPoint(object): + def __init__(self, method, routing): + self.method = method + self.routing = routing + def __call__(self, *args, **kw): + return self.method(*args, **kw) + def routing_map(modules, nodb_only, converters=None): routing_map = werkzeug.routing.Map(strict_slashes=False, converters=converters) for module in modules: @@ -523,21 +530,22 @@ def routing_map(modules, nodb_only, converters=None): members = inspect.getmembers(o) for mk, mv in members: if inspect.ismethod(mv) and hasattr(mv, 'routing'): - routing = dict(type='http', auth='user', methods=None) + routing = dict(type='http', auth='user', methods=None, routes=None) for claz in reversed(mv.im_class.mro()): fn = getattr(claz, mv.func_name, None) if fn and hasattr(fn, 'routing'): routing.update(fn.routing) - mv.routing.update(routing) - assert 'routes' in mv.routing - if not nodb_only or nodb_only == (mv.routing['auth'] == "none"): - for url in mv.routing['routes']: - if mv.routing.get("combine", False): + if not nodb_only or nodb_only == (routing['auth'] == "none"): + assert routing['routes'], "Method %r has not route defined" % mv + endpoint = EndPoint(mv, routing) + for url in routing['routes']: + if routing.get("combine", False): # deprecated url = o._cp_path.rstrip('/') + '/' + url.lstrip('/') if url.endswith("/") and len(url) > 1: url = url[: -1] - routing_map.add(werkzeug.routing.Rule(url, endpoint=mv, methods=mv.routing['methods'])) + + routing_map.add(werkzeug.routing.Rule(url, endpoint=endpoint, methods=routing['methods'])) return routing_map #----------------------------------------------------------