Reviewers: ,


Please review this at http://codereview.tryton.org/38009/

Affected files:
  M tryton/action/main.py
  M tryton/gui/window/view_board/action.py
  M tryton/gui/window/view_form/view/graph_gtk/graph.py
  M tryton/gui/window/view_form/view/list_gtk/parser.py


Index: tryton/action/main.py
===================================================================
--- a/tryton/action/main.py
+++ b/tryton/action/main.py
@@ -121,6 +121,7 @@
             }
             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 @@

             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 '{}')

Index: tryton/gui/window/view_board/action.py
===================================================================
--- a/tryton/gui/window/view_board/action.py
+++ b/tryton/gui/window/view_board/action.py
@@ -46,6 +46,7 @@
         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 @@
     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
Index: tryton/gui/window/view_form/view/graph_gtk/graph.py
===================================================================
--- 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 @@
                 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
Index: tryton/gui/window/view_form/view/list_gtk/parser.py
===================================================================
--- 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 @@
         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)


--
[email protected] mailing list

Reply via email to