diff --git a/sao/src/sao.js b/sao/src/sao.js index 1fc9821713b..73119b81e36 100644 --- a/sao/src/sao.js +++ b/sao/src/sao.js @@ -793,6 +793,10 @@ var Sao = { Sao.main_menu_row_activate = function() { var screen = Sao.main_menu_screen; + if (Date.now() - Sao.last_menu_open < 150) { + return; + } + Sao.last_menu_open = Date.now(); // ids is not defined to prevent to add suffix return Sao.Action.exec_keyword('tree_open', { 'model': screen.model_name, @@ -833,6 +837,7 @@ var Sao = { }); Sao.main_menu_screen = form.screen; Sao.main_menu_screen.switch_callback = null; + Sao.last_menu_open = Date.now(); Sao.Tab.tabs.splice(Sao.Tab.tabs.indexOf(form), 1); form.view_prm.done(function() { var view = form.screen.current_view; diff --git a/sao/src/tab.js b/sao/src/tab.js index 285cb826538..942a34f0587 100644 --- a/sao/src/tab.js +++ b/sao/src/tab.js @@ -793,33 +793,41 @@ } button.data('disabled', true); this.modified_save().then(function() { - var exec_action = jQuery.extend({}, qaction); - var record_id = null; - if (screen.current_record) { - record_id = screen.current_record.id; - } - var records, paths; - if (action.records == 'listed') { - records = screen.listed_records; - paths = screen.listed_paths; - } else { - records = screen.selected_records; - paths = screen.selected_paths; + try { + var exec_action = jQuery.extend({}, qaction); + var record_id = null; + if (screen.current_record) { + record_id = screen.current_record.id; + } + var records, paths; + if (action.records == 'listed') { + records = screen.listed_records; + paths = screen.listed_paths; + } else { + records = screen.selected_records; + paths = screen.selected_paths; + } + var record_ids = records.map(function(record) { + return record.id; + }); + var model_context = screen.context_screen ? + screen.context_screen.model_name : null; + var data = { + 'model': screen.model_name, + 'model_context': model_context, + 'id': record_id, + 'ids': record_ids, + 'paths': paths, + }; + Sao.Action.execute(exec_action, data, + jQuery.extend({}, screen.local_context)); + } finally { + button.data('disabled', false); } - var record_ids = records.map(function(record) { - return record.id; - }); - var model_context = screen.context_screen ? - screen.context_screen.model_name : null; - var data = { - 'model': screen.model_name, - 'model_context': model_context, - 'id': record_id, - 'ids': record_ids, - 'paths': paths, - }; - Sao.Action.execute(exec_action, data, - jQuery.extend({}, screen.local_context)); + }, + function(reason) { + button.data('disabled', false); + throw(reason); }); }); });