From afaeb9ce6c3dfd1e1c8f93271055aa52fc8345e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 16 Jun 2014 18:25:38 +0200 Subject: [PATCH] Fix mix up of record and id in popup_menu issue3990 review10371002 --- tryton/common/popup_menu.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tryton/common/popup_menu.py b/tryton/common/popup_menu.py index df4456936e..08e465eb8b 100644 --- a/tryton/common/popup_menu.py +++ b/tryton/common/popup_menu.py @@ -31,6 +31,11 @@ def populate(menu, model, record, title='', field=None): record = screen.current_record return record + def id_(record): + if not isinstance(record, (int, long)): + return record.id + return record + def activate(menuitem, action, atype): rec = load(record) action = Action.evaluate(action, atype, rec) @@ -48,11 +53,11 @@ def populate(menu, model, record, title='', field=None): Action._exec_action(action, data, {}) def attachment(menuitem): - Attachment(record, None) + Attachment(load(record), None) def edit(menuitem): with Window(hide_current=True, allow_similar=True): - Window.create(field.attrs.get('view_ids'), model, record, + Window.create(field.attrs.get('view_ids'), model, id_(record), mode=['form']) if title: