Add patch for issue4771

This commit is contained in:
Sergi Almacellas Abellana 2015-05-25 11:56:02 +02:00
parent b00b353c66
commit 0d0f1218b7
2 changed files with 71 additions and 0 deletions

70
issue13181002_1.diff Normal file
View file

@ -0,0 +1,70 @@
# HG changeset patch
# User Sergi Almacellas Abellana <sergi@koolpi.com>
save tree state when executing actions from list view menu
issue4771
review13181002
Index: tryton/tryton/common/popup_menu.py
===================================================================
--- a/tryton/tryton/common/popup_menu.py
+++ b/tryton/tryton/common/popup_menu.py
@@ -11,7 +11,7 @@
_ = gettext.gettext
-def populate(menu, model, record, title='', field=None):
+def populate(menu, model, record, title='', field=None, parent_screen=None):
'''
Fill menu with the actions of model for the record.
If title is filled, the actions will be put in a submenu.
@@ -37,6 +37,8 @@
return record
def activate(menuitem, action, atype):
+ if parent_screen:
+ parent_screen.save_tree_state()
rec = load(record)
action = Action.evaluate(action, atype, rec)
data = {
Index: tryton/tryton/gui/window/view_form/view/list.py
===================================================================
--- a/tryton/tryton/gui/window/view_form/view/list.py
+++ b/tryton/tryton/gui/window/view_form/view/list.py
@@ -901,7 +901,7 @@
menu = gtk.Menu()
menu.popup(None, None, None, event.button, event.time)
- def pop(menu, group, record):
+ def pop(menu, group, record, screen):
copy_item = gtk.ImageMenuItem('gtk-copy')
copy_item.connect('activate', lambda x: self.on_copy())
menu.append(copy_item)
@@ -915,7 +915,8 @@
break
parent = parent.parent
else:
- populate(menu, group.model_name, record)
+ populate(menu, group.model_name, record,
+ parent_screen=screen)
for col in self.treeview.get_columns():
if not col.get_visible() or not col.name:
continue
@@ -932,10 +933,11 @@
if not model:
continue
label = field.attrs['string']
- populate(menu, model, record_id, title=label, field=field)
+ populate(menu, model, record_id, title=label, field=field,
+ parent_screen=screen)
menu.show_all()
# Delay filling of popup as it can take time
- gobject.idle_add(pop, menu, group, record)
+ gobject.idle_add(pop, menu, group, record, self.screen)
elif event.button == 2:
event.button = 1
event.state |= gtk.gdk.MOD1_MASK

1
series
View file

@ -52,3 +52,4 @@ purchase_translation.diff
issue15251002_1.diff
issue9801002_40001.diff
issue19281002_1.diff
issue13181002_1.diff