Naresh(OpenERP) has proposed merging
lp:~openerp-dev/openobject-client/trunk-bug-785677-nch into
lp:openobject-client.
Requested reviews:
OpenERP sa GTK client R&D (openerp-dev-gtk)
Related bugs:
Bug #785677 in OpenERP GTK Client: "Can not create several group_by filters
on the same field(s)"
https://bugs.launchpad.net/openobject-client/+bug/785677
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client/trunk-bug-785677-nch/+merge/69456
--
https://code.launchpad.net/~openerp-dev/openobject-client/trunk-bug-785677-nch/+merge/69456
Your team OpenERP sa GTK client R&D is requested to review the proposed merge
of lp:~openerp-dev/openobject-client/trunk-bug-785677-nch into
lp:openobject-client.
=== modified file 'bin/widget/view/list.py'
--- bin/widget/view/list.py 2011-06-29 06:08:59 +0000
+++ bin/widget/view/list.py 2011-07-27 12:57:43 +0000
@@ -716,7 +716,7 @@
group_col = []
for x in groupby:
group_col += [col for col in self.columns if col.name == x]
- group_col = group_col + filter(lambda x:x.name not in groupby, self.columns)
+ group_col = group_col + filter(lambda x:x.name not in groupby, self.columns)
for col in group_col:
if col.name in groupby:
if not col in self.changed_col:
=== modified file 'bin/widget_search/filter.py'
--- bin/widget_search/filter.py 2011-04-06 10:24:26 +0000
+++ bin/widget_search/filter.py 2011-07-27 12:57:43 +0000
@@ -35,6 +35,7 @@
self.butt = gtk.ToggleButton()
self.butt.set_relief(gtk.RELIEF_NONE)
icon = gtk.Image()
+ self.name = name or attrs.get('string')
icon_to_set = attrs.get('icon','gtk-home')
if icon_to_set.startswith('STOCK'):
icon_to_set = getattr(gtk, icon_to_set)
@@ -60,10 +61,11 @@
ctx = tools.expr_eval(self.context, {'context':self.screen_context})
group = ctx.get('group_by',False)
if group:
- return {'context': {'remove_group':group}}
+ return {'context': {'remove_group':True}, 'name':self.name}
return {}
return {'domain': tools.expr_eval(self.domain, {'context':self.screen_context}),
- 'context': tools.expr_eval(self.context, {'context':self.screen_context})}
+ 'context': tools.expr_eval(self.context, {'context':self.screen_context}),
+ 'name':self.name }
def sig_exec(self, widget):
pass
=== modified file 'bin/widget_search/form.py'
--- bin/widget_search/form.py 2011-06-27 09:02:09 +0000
+++ bin/widget_search/form.py 2011-07-27 12:57:43 +0000
@@ -307,7 +307,8 @@
ww, hw = 640,800
if self.parent:
ww, hw = self.parent.size_request()
- self.groupby = []
+ self.groupby = {}
+ self.gp_filters = []
self.widget, self.widgets = parser.parse_filter(xml_arch, ww, root_node, call=call)
self.rows = 4
self.focusable = parser.focusable
@@ -438,21 +439,27 @@
for x in self.widgets.values() + self.custom_widgets.values():
filters = x[0].value
- domain += filters.get('domain',[])
- ctx = filters.get('context',{})
+ domain += filters.get('domain', [])
+ ctx = filters.get('context', {})
+ gp_name = filters.pop('name', False)
ctx_groupby = ctx.pop('group_by', False)
- ctx_remove_group = ctx.pop('remove_group',False)
+ ctx_remove_group = ctx.pop('remove_group', False)
if ctx_groupby:
if not isinstance(ctx_groupby, list):
ctx_groupby = [ctx_groupby]
- [self.groupby.append(x) for x in ctx_groupby if x not in self.groupby]
+ self.groupby.setdefault(gp_name, [])
+ if gp_name not in self.gp_filters:
+ self.gp_filters.append(gp_name)
+ self.groupby[gp_name] = ctx_groupby
elif ctx_remove_group:
- if not isinstance(ctx_remove_group, list):
- ctx_remove_group = [ctx_remove_group]
- [self.groupby.remove(x) for x in ctx_remove_group if x in self.groupby]
+ if gp_name in self.gp_filters:
+ self.gp_filters.remove(gp_name)
context.update(ctx)
- if self.groupby:
- context.update({'group_by':self.groupby})
+ ordered_gp = []
+ for val in self.gp_filters:
+ ordered_gp += self.groupby[val]
+ if ordered_gp:
+ context.update({'group_by':ordered_gp})
if domain:
pos = False
if '&' in domain or '|' in domain:
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp