From ac628353be898c05c5ba1033e4df342cd5f19615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 3 Oct 2021 00:40:18 +0200 Subject: [PATCH] Create toolbar synchronously The record_message function needs that all the buttons are created when it is triggered. So we can not delay the creation with an asynchronous call. issue10783 review360151002 (grafted from a6315854511588fef77cc83c5e37d13b31c55727) --HG-- branch : 6.0 --- src/tab.js | 200 ++++++++++++++++++++++++++--------------------------- 1 file changed, 99 insertions(+), 101 deletions(-) diff --git a/src/tab.js b/src/tab.js index 2c6f44802e..7aa83208ae 100644 --- a/src/tab.js +++ b/src/tab.js @@ -513,21 +513,20 @@ create_toolbar: function() { var toolbar = Sao.Tab.Form._super.create_toolbar.call(this); var screen = this.screen; - var prm = screen.model.execute('view_toolbar_get', [], - screen.context); - prm.done(function(toolbars) { - [ + var toolbars = screen.model.execute( + 'view_toolbar_get', [], screen.context, false); + [ ['action', 'tryton-launch', Sao.i18n.gettext('Launch action')], ['relate', 'tryton-link', - Sao.i18n.gettext('Open related records')], + Sao.i18n.gettext('Open related records')], ['print', 'tryton-print', - Sao.i18n.gettext('Print report')] - ].forEach(function(menu_action) { - var dropdown = jQuery('
', { - 'class': 'btn-group dropdown', - 'role': 'group' - }) + Sao.i18n.gettext('Print report')] + ].forEach(function(menu_action) { + var dropdown = jQuery('
', { + 'class': 'btn-group dropdown', + 'role': 'group' + }) .append(jQuery('