Remove all implicite storage of rpc.CONTEXT for issue311
rpc.CONTEXT must be used only temporarily for evaluation and not store because it can change if user change preferences
This commit is contained in:
1 parent
46c15d2eff
commit
00bfe945f3
7 files changed
+10
-13
No files matched your search
@@ -59,7 +59,7 @@ class Action(object):
|
||||
def execute(act_id, datas, window, action_type=None, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
ctx = rpc.CONTEXT.copy()
|
||||
ctx = {}
|
||||
ctx.update(context)
|
||||
if not action_type:
|
||||
res = False
|
||||
@@ -83,7 +83,7 @@ class Action(object):
|
||||
@staticmethod
|
||||
def _exec_action(action, window, datas=None, context=None):
|
||||
if context is None:
|
||||
context = rpc.CONTEXT.copy()
|
||||
context = {}
|
||||
if datas is None:
|
||||
datas = {}
|
||||
if 'type' not in action:
|
||||
@@ -117,7 +117,8 @@ class Action(object):
|
||||
ctx.update(rpc.CONTEXT)
|
||||
eval_ctx = ctx.copy()
|
||||
eval_ctx['datetime'] = datetime
|
||||
ctx.update(eval(action.get('context') or '{}', eval_ctx))
|
||||
action_ctx = eval(action.get('context') or '{}', eval_ctx)
|
||||
ctx.update(action_ctx)
|
||||
ctx.update(context)
|
||||
|
||||
domain_context = ctx.copy()
|
||||
@@ -138,7 +139,7 @@ class Action(object):
|
||||
name = action.get('name', False)
|
||||
|
||||
Window.create(view_ids, datas['res_model'], datas['res_id'], domain,
|
||||
action['view_type'], window, ctx,
|
||||
action['view_type'], window, action_ctx,
|
||||
datas['view_mode'], name=name,
|
||||
limit=datas['limit'], auto_refresh=datas['auto_refresh'],
|
||||
search_value=search_value)
|
||||
|
||||
+1
-2
@@ -209,12 +209,11 @@ class Main(object):
|
||||
|
||||
def shortcut_set(self, shortcuts=None):
|
||||
def _action_shortcut(widget, action):
|
||||
ctx = rpc.CONTEXT.copy()
|
||||
Action.exec_keyword('tree_open', self.window, {
|
||||
'model': 'ir.ui.menu',
|
||||
'id': action,
|
||||
'ids': [action],
|
||||
}, context=ctx)
|
||||
})
|
||||
if shortcuts is None:
|
||||
user = rpc._USER
|
||||
try:
|
||||
|
||||
@@ -77,7 +77,6 @@ class ModelRecordGroup(SignalEvent):
|
||||
self.window = window
|
||||
self.parent = parent
|
||||
self._context = context or {}
|
||||
self._context.update(rpc.CONTEXT)
|
||||
self.resource = resource
|
||||
self.rpc = RPCProxy(resource)
|
||||
self.fields = fields
|
||||
@@ -200,7 +199,7 @@ class ModelRecordGroup(SignalEvent):
|
||||
self.model_deleted = []
|
||||
|
||||
def _get_context(self):
|
||||
ctx = {}
|
||||
ctx = rpc.CONTEXT.copy()
|
||||
ctx.update(self._context)
|
||||
return ctx
|
||||
context = property(_get_context)
|
||||
|
||||
@@ -53,7 +53,6 @@ class Screen(SignalEvent):
|
||||
self.resource = model_name
|
||||
self.rpc = RPCProxy(model_name)
|
||||
self.context = context
|
||||
self.context.update(rpc.CONTEXT)
|
||||
self.views = []
|
||||
self.fields = {}
|
||||
self.view_ids = view_ids
|
||||
|
||||
@@ -328,7 +328,6 @@ class ViewTree(object):
|
||||
self.view = gtk.TreeView()
|
||||
self.view.set_headers_visible(not CONFIG['client.modepda'])
|
||||
self.context = {}
|
||||
self.context.update(rpc.CONTEXT)
|
||||
if context:
|
||||
self.context.update(context)
|
||||
self.fields = view_info['fields']
|
||||
|
||||
@@ -18,7 +18,6 @@ class WinSearch(object):
|
||||
views_preload = {}
|
||||
self.domain = domain or []
|
||||
self.context = context or {}
|
||||
self.context.update(rpc.CONTEXT)
|
||||
self.sel_multi = sel_multi
|
||||
self.parent = parent
|
||||
|
||||
@@ -61,9 +60,11 @@ class WinSearch(object):
|
||||
if 'tree' in views_preload:
|
||||
view_form = views_preload['tree']
|
||||
else:
|
||||
ctx = self.context.copy()
|
||||
ctx.update(rpc.CONTEXT)
|
||||
try:
|
||||
args = ('object', 'execute', self.model_name, 'fields_view_get',
|
||||
False, 'tree', self.context)
|
||||
False, 'tree', ctx)
|
||||
view_form = rpc.execute(*args)
|
||||
except Exception, exception:
|
||||
view_form = common.process_exception(exception, self.parent, *args)
|
||||
|
||||
@@ -12,7 +12,6 @@ class Window(object):
|
||||
from tryton.gui import Main
|
||||
if context is None:
|
||||
context = {}
|
||||
context.update(rpc.CONTEXT)
|
||||
|
||||
if view_type == 'form':
|
||||
from form import Form
|
||||
|
||||
Reference in new issue
Block a user