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)