Add missing context and _user in some PYSONDecoder
review38009
This commit is contained in:
1 parent
c1e8e94aeb
commit
c22444183e
4 files changed
+15
-5
No files matched your search
@@ -121,6 +121,7 @@ class Action(object):
|
||||
}
|
||||
ctx.update(rpc.CONTEXT)
|
||||
eval_ctx = ctx.copy()
|
||||
eval_ctx['_user'] = rpc._USER
|
||||
action_ctx = PYSONDecoder(eval_ctx).decode(
|
||||
action.get('pyson_context') or '{}')
|
||||
ctx.update(action_ctx)
|
||||
@@ -128,10 +129,12 @@ class Action(object):
|
||||
|
||||
domain_context = ctx.copy()
|
||||
domain_context['context'] = ctx
|
||||
domain_context['_user'] = rpc._USER
|
||||
domain = PYSONDecoder(domain_context).decode(action['pyson_domain'])
|
||||
|
||||
search_context = ctx.copy()
|
||||
search_context['context'] = ctx
|
||||
search_context['_user'] = rpc._USER
|
||||
search_value = PYSONDecoder(search_context).decode(
|
||||
action['pyson_search_value'] or '{}')
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ class Action(SignalEvent):
|
||||
self.action.setdefault('pyson_domain', '[]')
|
||||
self.context.update({'active_id': False, 'active_ids': []})
|
||||
self.context.update(rpc.CONTEXT)
|
||||
self.context['_user'] = rpc._USER
|
||||
self.context.update(PYSONDecoder(self.context).decode(
|
||||
self.action.get('pyson_context', '{}')))
|
||||
|
||||
@@ -231,6 +232,7 @@ class Action(SignalEvent):
|
||||
def update_domain(self, actions):
|
||||
domain_ctx = self.context.copy()
|
||||
domain_ctx['context'] = domain_ctx
|
||||
domain_ctx['_user'] = rpc._USER
|
||||
for action in actions:
|
||||
if action.active:
|
||||
domain_ctx['_active_%s' % action.act_id] = action.active
|
||||
|
||||
@@ -352,11 +352,13 @@ class Graph(gtk.DrawingArea):
|
||||
key = yfield.get('key', yfield['name'])
|
||||
self.datas[x].setdefault(key, 0.0)
|
||||
if yfield.get('domain'):
|
||||
values = rpc.CONTEXT.copy()
|
||||
values['state'] = 'draft'
|
||||
context = rpc.CONTEXT.copy()
|
||||
context['context'] = context.copy()
|
||||
context['_user'] = rpc._USER
|
||||
for field in model.group.fields:
|
||||
values[field] = model[field].get(model, check_load=False)
|
||||
if not PYSONDecoder(values).decode(yfield['domain']):
|
||||
context[field] = model[field].get(model,
|
||||
check_load=False)
|
||||
if not PYSONDecoder(context).decode(yfield['domain']):
|
||||
continue
|
||||
if yfield['name'] == '#':
|
||||
self.datas[x][key] += 1
|
||||
|
||||
@@ -710,7 +710,10 @@ class Selection(Char):
|
||||
if not self.attrs.get('domain'):
|
||||
domain = []
|
||||
else:
|
||||
domain = PYSONDecoder(rpc.CONTEXT).decode(self.attrs['domain'])
|
||||
context = rpc.CONTEXT.copy()
|
||||
context['context'] = context.copy()
|
||||
context['_user'] = rpc._USER
|
||||
domain = PYSONDecoder(context).decode(self.attrs['domain'])
|
||||
if 'relation' in self.attrs:
|
||||
args = ('model', self.attrs['relation'], 'search_read',
|
||||
domain, 0, None, None, ['rec_name'], rpc.CONTEXT)
|
||||
|
||||
Reference in new issue
Block a user