diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-06-06 11:54:35 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-06-06 11:54:35 +0200 |
| commit | 71a50a2214748fec413c5a0f042d0e7172ae6ea9 (patch) | |
| tree | 2e9ee11551350e23923390d9c53baf630b6ed834 /addons/web/static/src/js | |
| parent | a7621137cb0d75ec545152d5e1d413c9d3548e45 (diff) | |
| parent | 409679866b2ee8352a8cb27460e7332563526924 (diff) | |
[MERGE] forward port branch saas-12.3 up to 409679866b2
Diffstat (limited to 'addons/web/static/src/js')
7 files changed, 47 insertions, 23 deletions
diff --git a/addons/web/static/src/js/chrome/abstract_web_client.js b/addons/web/static/src/js/chrome/abstract_web_client.js index f1af6fc7234..6b7df97b767 100644 --- a/addons/web/static/src/js/chrome/abstract_web_client.js +++ b/addons/web/static/src/js/chrome/abstract_web_client.js @@ -514,7 +514,11 @@ var AbstractWebClient = Widget.extend(ServiceProviderMixin, KeyboardNavigationMi new RainbowMan(data).appendTo(this.$el); } else { // For instance keep title blank, as we don't have title in data - this.notification_manager.notify('', data.message, true); + this.call('notification', 'notify', { + title: "", + message: data.message, + sticky: false + }); } } else { throw new Error('Unknown effect type: ' + type); diff --git a/addons/web/static/src/js/chrome/action_manager_act_window.js b/addons/web/static/src/js/chrome/action_manager_act_window.js index f694e2ca1b0..ee3ce15bdd2 100644 --- a/addons/web/static/src/js/chrome/action_manager_act_window.js +++ b/addons/web/static/src/js/chrome/action_manager_act_window.js @@ -58,7 +58,11 @@ ActionManager.include({ * @param {string} [state.view_type] */ loadState: function (state) { + var callersArguments = arguments; + var _super = this._super.bind(this); + var self = this; var action; + var def; var options = { clear_breadcrumbs: true, pushState: false, @@ -113,11 +117,20 @@ ActionManager.include({ action = lastAction; options.viewType = state.view_type; } + } else if (state.sa) { + def = this._rpc({ + route: '/web/session/get_session_action', + params: {key: state.sa}, + }).then(function (sessionAction) { + action = sessionAction; + }); } - if (action) { - return this.doAction(action, options); - } - return this._super.apply(this, arguments); + return Promise.all([def]).then(function () { + if (action) { + return self.doAction(action, options); + } + return _super.apply(self, callersArguments); + }); }, //-------------------------------------------------------------------------- diff --git a/addons/web/static/src/js/core/ajax.js b/addons/web/static/src/js/core/ajax.js index a5ed4065282..af7628cc5ea 100644 --- a/addons/web/static/src/js/core/ajax.js +++ b/addons/web/static/src/js/core/ajax.js @@ -27,11 +27,17 @@ function _genericJsonRpc (fct_name, params, settings, fct) { core.bus.trigger('rpc:result', data, result); if (result.error !== undefined) { if (result.error.data.arguments[0] !== "bus.Bus not available in test mode") { + var func = console.error; if (result.error.data.exception_type === "user_error") { - console.log("Server application error", JSON.stringify(result.error)); - } else { - console.error("Server application error", JSON.stringify(result.error)); + func = console.log; } + func( + "Server application error\n", + "Error code:", result.error.code, "\n", + "Error message:", result.error.message, "\n", + "Error data message:\n", result.error.data.message, "\n", + "Error data debug:\n", result.error.data.debug + ); } return Promise.reject({type: "server", error: result.error}); } else { diff --git a/addons/web/static/src/js/tools/test_menus.js b/addons/web/static/src/js/tools/test_menus.js index 4b7ee4b2e02..82a4ed26c0e 100644 --- a/addons/web/static/src/js/tools/test_menus.js +++ b/addons/web/static/src/js/tools/test_menus.js @@ -44,8 +44,12 @@ } } - // Main function that starts orchestration of tests function clickEverywhere(){ + setTimeout(_clickEverywhere, 1000); + } + + // Main function that starts orchestration of tests + function _clickEverywhere(){ console.log("Starting ClickEverywhere test"); var startTime = performance.now(); createWebClientHooks(); diff --git a/addons/web/static/src/js/views/calendar/calendar_controller.js b/addons/web/static/src/js/views/calendar/calendar_controller.js index 61a966972aa..b3a04ec9a2b 100644 --- a/addons/web/static/src/js/views/calendar/calendar_controller.js +++ b/addons/web/static/src/js/views/calendar/calendar_controller.js @@ -160,7 +160,8 @@ var CalendarController = AbstractController.extend({ * @returns {Promise} */ _updateRecord: function (record) { - return this.model.updateRecord(record).then(this.reload.bind(this, {})); + var reload = this.reload.bind(this, {}); + return this.model.updateRecord(record).then(reload, reload); }, //-------------------------------------------------------------------------- diff --git a/addons/web/static/src/js/views/calendar/calendar_model.js b/addons/web/static/src/js/views/calendar/calendar_model.js index 0ad1b61e4d7..c3934d930d7 100644 --- a/addons/web/static/src/js/views/calendar/calendar_model.js +++ b/addons/web/static/src/js/views/calendar/calendar_model.js @@ -310,7 +310,7 @@ return AbstractModel.extend({ * Toggle the sidebar (containing the mini calendar) */ toggleFullWidth: function () { - var fullWidth = this.call('local_storage', 'getItem', 'calendar_fullWidth') !== 'true'; + var fullWidth = this.call('local_storage', 'getItem', 'calendar_fullWidth') !== true; this.call('local_storage', 'setItem', 'calendar_fullWidth', fullWidth); }, /** @@ -442,7 +442,7 @@ return AbstractModel.extend({ */ _loadCalendar: function () { var self = this; - this.data.fullWidth = this.call('local_storage', 'getItem', 'calendar_fullWidth') === 'true'; + this.data.fullWidth = this.call('local_storage', 'getItem', 'calendar_fullWidth') === true; this.data.fc_options = this._getFullCalendarOptions(); var defs = _.map(this.data.filters, this._loadFilter.bind(this)); diff --git a/addons/web/static/src/js/widgets/date_picker.js b/addons/web/static/src/js/widgets/date_picker.js index 3206ef7b47a..5b4480838fe 100644 --- a/addons/web/static/src/js/widgets/date_picker.js +++ b/addons/web/static/src/js/widgets/date_picker.js @@ -13,6 +13,7 @@ var DateWidget = Widget.extend({ type_of_date: "date", events: { 'change.datetimepicker': 'changeDatetime', + 'error.datetimepicker': 'errorDatetime', 'change .o_datepicker_input': 'changeDatetime', 'click input': '_onInputClicked', 'input input': '_onInput', @@ -112,6 +113,12 @@ var DateWidget = Widget.extend({ } }, /** + * Library clears the wrong date format so just ignore error + */ + errorDatetime: function (e) { + return false; + }, + /** * Focuses the datepicker input. This function must be called in order to * prevent 'input' events triggered by the lib to bubble up, and to cause * unwanted effects (like triggering 'field_changed' events) @@ -276,17 +283,6 @@ var DateWidget = Widget.extend({ */ _onKeydown: function (ev) { if (ev.which === $.ui.keyCode.ESCAPE) { - this.__libInput++; - this.$el.datetimepicker('hide'); - this.__libInput--; - } - }, - /** - * @private - * @param {KeyEvent} ev - */ - _onKeydown: function (ev) { - if (ev.which === $.ui.keyCode.ESCAPE) { if (this.__isOpen) { // we don't want any other effects than closing the datepicker, // like leaving the edition of a row in editable list view |
