diff --git a/tryton/action/main.py b/tryton/action/main.py index 0ca095c67e..1c055f5f24 100644 --- a/tryton/action/main.py +++ b/tryton/action/main.py @@ -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 '{}') diff --git a/tryton/gui/window/view_board/action.py b/tryton/gui/window/view_board/action.py index b860d9a82a..3b933d6831 100644 --- a/tryton/gui/window/view_board/action.py +++ b/tryton/gui/window/view_board/action.py @@ -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 diff --git a/tryton/gui/window/view_form/view/graph_gtk/graph.py b/tryton/gui/window/view_form/view/graph_gtk/graph.py index ec1fbb4d60..8413234461 100644 --- a/tryton/gui/window/view_form/view/graph_gtk/graph.py +++ b/tryton/gui/window/view_form/view/graph_gtk/graph.py @@ -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 diff --git a/tryton/gui/window/view_form/view/list_gtk/parser.py b/tryton/gui/window/view_form/view/list_gtk/parser.py index 2970ee0cfe..2e49d94c00 100644 --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -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)