From a5a1d83bc0654de508bb6e0855db3dbf828f72a8 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Thu, 9 Jan 2020 15:22:43 +0100 Subject: [PATCH] Use sync request on screen.get_selection Otherwise the values may not be set when reading them issue8975 review288791002 --- src/screen.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/screen.js b/src/screen.js index b8e390774b..a4dca5f2d6 100644 --- a/src/screen.js +++ b/src/screen.js @@ -1619,11 +1619,6 @@ } var fields = jQuery.extend({}, view_tree.fields); - var set_selection = function(props) { - return function(selection) { - props.selection = selection; - }; - }; for (var name in fields) { var props = fields[name]; if ((props.type != 'selection') && @@ -1633,7 +1628,7 @@ if (props.selection instanceof Array) { continue; } - this.get_selection(props).then(set_selection(props)); + props.selection = this.get_selection(props); } if ('arch' in view_tree) { @@ -1692,23 +1687,21 @@ return domain_parser; }, get_selection: function(props) { - var prm; + var selection; var change_with = props.selection_change_with; if (!jQuery.isEmptyObject(change_with)) { var values = {}; change_with.forEach(function(p) { values[p] = null; }); - prm = this.model.execute(props.selection, - [values]); + selection = this.model.execute(props.selection, + [values], undefined, false); } else { - prm = this.model.execute(props.selection, - []); + selection = this.model.execute(props.selection, + [], undefined, false); } - return prm.then(function(selection) { - return selection.sort(function(a, b) { - return a[1].localeCompare(b[1]); - }); + return selection.sort(function(a, b) { + return a[1].localeCompare(b[1]); }); }, search_prev: function(search_string) {