Numérigraphe has proposed merging lp:~numerigraphe/openobject-client/6.x-o2m-focus-reset into lp:openobject-client.
Requested reviews: OpenERP sa GTK client R&D (openerp-dev-gtk) Related bugs: Bug #1072784 in OpenERP GTK Client: "Clicking a button in a form view brings one-to-many widgets back to the first record" https://bugs.launchpad.net/openobject-client/+bug/1072784 For more details, see: https://code.launchpad.net/~numerigraphe/openobject-client/6.x-o2m-focus-reset/+merge/138148 If you perform an action on a form requiring it to reload (for example click a button), every o2m widget is reset to its first record. This branch fixes this by setting the focus back to the previously selected record after reloading. The patches were developed in private as part of our paid support agreement, but we're willing to have them publicly available. Lionel Sausin. -- https://code.launchpad.net/~numerigraphe/openobject-client/6.x-o2m-focus-reset/+merge/138148 Your team OpenERP sa GTK client R&D is requested to review the proposed merge of lp:~numerigraphe/openobject-client/6.x-o2m-focus-reset into lp:openobject-client.
=== modified file 'bin/widget/model/record.py' --- bin/widget/model/record.py 2012-02-28 09:14:42 +0000 +++ bin/widget/model/record.py 2012-12-05 13:42:22 +0000 @@ -400,7 +400,7 @@ else: raise Exception, 'Unallowed button type' if screen.current_model and screen.current_view.view_type != 'tree': - screen.reload() + screen.reload(res_id=id) del screen === modified file 'bin/widget/screen/screen.py' --- bin/widget/screen/screen.py 2012-05-18 10:11:32 +0000 +++ bin/widget/screen/screen.py 2012-12-05 13:42:22 +0000 @@ -754,11 +754,11 @@ return True return False - def reload(self): + def reload(self, res_id=None): self.current_model.reload() if self.parent: self.parent.reload() - self.display() + self.display(res_id=res_id) def remove(self, unlink = False): id = False === modified file 'bin/widget/view/form_gtk/one2many_list.py' --- bin/widget/view/form_gtk/one2many_list.py 2011-12-12 07:10:21 +0000 +++ bin/widget/view/form_gtk/one2many_list.py 2012-12-05 13:42:22 +0000 @@ -407,6 +407,7 @@ name = str(signal_data[0] + 1) line = '(%s/%s of %s)' % (name, signal_data[1], signal_data[2]) self.label.set_text(line) + self.pager.set_sensitivity() def _sig_refresh(self, *args): pass === modified file 'bin/widget/view/list.py' --- bin/widget/view/list.py 2011-11-29 09:00:41 +0000 +++ bin/widget/view/list.py 2012-12-05 13:42:22 +0000 @@ -592,6 +592,21 @@ if self.screen.parent and isinstance(self.screen.parent, ModelRecord): self.screen.parent.reload() current_active_model.reload() + # we force setting current_model here to avoid tree view blinking + # (cause by view selecting the 1st record, then re-displaying itself, + # then selecting real active record) + self.screen.current_model = current_active_model + if selection.get_mode() == gtk.SELECTION_MULTIPLE: + path_active_model = self.store.on_get_path(current_active_model) + if path_active_model not in paths: + # clicked row is not in active selection, + # select only the current row + selection.select_path(path_active_model) + else: + # keep current rows selected + for path in paths: + selection.select_path(path) + self.widget_tree.scroll_to_cell(path_active_model) else: # Here it goes for right click
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp