From 7daeef687d01c00bfcd019c07d8d7b82a1bf6551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 27 Feb 2014 12:43:13 +0100 Subject: [PATCH] button press use the wrong record to popup the menu issue3702 review3691004 --- tryton/gui/window/view_form/view/list.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tryton/gui/window/view_form/view/list.py b/tryton/gui/window/view_form/view/list.py index c2c1a72121..359023652d 100644 --- a/tryton/gui/window/view_form/view/list.py +++ b/tryton/gui/window/view_form/view/list.py @@ -594,16 +594,19 @@ class ViewList(ParserView): def __button_press(self, treeview, event): if event.button == 3: - path = treeview.get_path_at_pos(int(event.x), int(event.y)) + try: + path, col, x, y = treeview.get_path_at_pos( + int(event.x), int(event.y)) + except TypeError: + # Outside row + return False selection = treeview.get_selection() if selection.get_mode() == gtk.SELECTION_SINGLE: model = selection.get_selected()[0] elif selection.get_mode() == gtk.SELECTION_MULTIPLE: model = selection.get_selected_rows()[0] - if (not path) or not path[0]: - return False - group = model.group - record = group[path[0][0]] + record = model.get_value(model.get_iter(path), 0) + group = record.group menu = gtk.Menu() menu.popup(None, None, None, event.button, event.time)