From 2cb332fe4c37a069c9f129f4e3a3a8bdcd60bad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 27 Nov 2017 22:15:46 +0100 Subject: [PATCH] Show related record names for all windows except from menu action. issue6966 review42871002 --- CHANGELOG | 1 + src/action.js | 2 +- src/sao.js | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1c39c20f7c..5eb049df06 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Show related record names for all windows * Allow to edit Many2One from tree view * Use translated values when exporting Reference and Selection fields diff --git a/src/action.js b/src/action.js index a027943312..e535f09e32 100644 --- a/src/action.js +++ b/src/action.js @@ -102,7 +102,7 @@ } params.icon = action['icon.rec_name'] || ''; - if ((action.keyword || '') === 'form_relate') { + if (action.keyword) { name_prm = add_name_suffix(action.name); } name_prm.then(function(name) { diff --git a/src/sao.js b/src/sao.js index 4cedb76dd2..8fe327439d 100644 --- a/src/sao.js +++ b/src/sao.js @@ -362,10 +362,10 @@ var Sao = {}; a.append(menu_item[1]); a.click(function() { clear_menu(); + // ids is not defined to prevent to add suffix Sao.Action.exec_keyword('tree_open', { 'model': Sao.main_menu_screen.model_name, 'id': id, - 'ids': [id], }); }); menu.append(li); @@ -407,6 +407,15 @@ var Sao = {}; }).click(Sao.favorites_menu).append(Sao.i18n.gettext('Favorites'))); }; + Sao.main_menu_row_activate = function() { + var screen = Sao.main_menu_screen; + // ids is not defined to prevent to add suffix + return Sao.Action.exec_keyword('tree_open', { + 'model': screen.model_name, + 'id': screen.get_id(), + }, jQuery.extend({}, screen.context), false); + }; + Sao.menu = function(preferences) { var decoder = new Sao.PYSON.Decoder(); var action = decoder.decode(preferences.pyson_menu); @@ -427,7 +436,8 @@ var Sao = {}; 'domain': domain, 'context': action_ctx, 'selection_mode': Sao.common.SELECTION_NONE, - 'limit': null + 'limit': null, + 'row_activate': Sao.main_menu_row_activate, }); Sao.Tab.tabs.splice(Sao.Tab.tabs.indexOf(form), 1); form.view_prm.done(function() { @@ -595,10 +605,10 @@ var Sao = {}; }, match_selected: function(item) { if (item.model == Sao.main_menu_screen.model_name) { + // ids is not defined to prevent to add suffix Sao.Action.exec_keyword('tree_open', { 'model': item.model, 'id': item.record_id, - 'ids': [item.record_id] }, Sao.main_menu_screen.context); } else { var params = {