← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-client/6.0-opw-5921-ysa into lp:openobject-client/6.0

 

Yogesh(Open ERP) has proposed merging lp:~openerp-dev/openobject-client/6.0-opw-5921-ysa into lp:openobject-client/6.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client/6.0-opw-5921-ysa/+merge/62454

fix problem of if context apply in o2m fiel then context not pass in fields_view_get(). get default value of model and eval with context and then context pass in screen on one2many field.
-- 
https://code.launchpad.net/~openerp-dev/openobject-client/6.0-opw-5921-ysa/+merge/62454
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-client/6.0-opw-5921-ysa.
=== modified file 'bin/widget/view/form_gtk/one2many_list.py'
--- bin/widget/view/form_gtk/one2many_list.py	2011-01-03 12:36:16 +0000
+++ bin/widget/view/form_gtk/one2many_list.py	2011-05-26 10:43:18 +0000
@@ -33,6 +33,7 @@
 from pager import pager
 import service
 import tools
+import rpc
 
 
 class dialog(object):
@@ -149,14 +150,6 @@
     def __init__(self, window, parent, model, attrs={}):
         interface.widget_interface.__init__(self, window, parent, model, attrs)
         self.context = {}
-        #TODO:
-            # group by context are evaled here as we need the context in screen
-            # while displaying.
-            # We need a better way to eval context that has group_by'
-            # We needed to do this as normal context also get evaled here
-            # and results in a traceback which should not be evaled here.
-        if str(attrs.get('context',"{}")).find('group_by') != -1:
-            self.context = tools.expr_eval(attrs.get('context',"{}"))
         self._readonly = self.default_readonly
         self.widget = gtk.VBox(homogeneous=False, spacing=5)
         hb = gtk.HBox(homogeneous=False, spacing=5)
@@ -180,14 +173,14 @@
         menubar.add(menuitem_title)
         hb.pack_start(menubar, expand=True, fill=True)
 
-        if self.context.get('group_by'):
-            self.context['group_by'] = [self.context['group_by']]
-
         # the context to pass to default_get can be optionally specified in
         # the context of the one2many field. We also support a legacy
         # 'default_get' attribute for the same effect (pending removal)
         default_get_ctx = (attrs.get('default_get') or attrs.get('context'))
 
+        fields = rpc.session.rpc_exec_auth('/object', 'execute', model, 'fields_get', False, self.context)
+        res = rpc.session.rpc_exec_auth_try('/object', 'execute', model, 'default_get', fields)
+        self.context = tools.expr_eval("dict(%s)" % attrs.get('context',"{}"), res)
         self.screen = Screen(attrs['relation'],
                             view_type=attrs.get('mode','tree,form').split(','),
                             parent=self.parent, views_preload=attrs.get('views', {}),