From 7766b89aa04f31c086f9e967965b2ff3d8d10410 Mon Sep 17 00:00:00 2001 From: Nimesh Jethva Date: Thu, 6 Sep 2018 08:43:32 +0000 Subject: [FIX] web: restore kanban progressbar animation With BS4 migration, the progressbar 'active' class should have been renamed 'progress-bar-animated'. closes odoo/odoo#26868 Signed-off-by: Quentin Smetz (qsm) --- addons/web/static/src/js/views/kanban/kanban_column_progressbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js b/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js index 59f09bc9bb6..4a572739daf 100644 --- a/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js +++ b/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js @@ -158,7 +158,7 @@ var KanbanColumnProgressBar = Widget.extend({ }); // Adapt active state - $bar.toggleClass('active progress-bar-striped', key === self.activeFilter); + $bar.toggleClass('progress-bar-animated progress-bar-striped', key === self.activeFilter); // Adapt width $bar.removeClass('o_bar_has_records transition-off'); -- cgit v1.2.3 From 0ac405550452cb304408b56313776fd3f9538dc7 Mon Sep 17 00:00:00 2001 From: Mohammed Shekha Date: Tue, 9 Jul 2019 08:53:42 +0000 Subject: [IMP] web: do not set focus on form when lastActivatedFieldIndex is not set When opening a dialog using mouse and closing it, form_dialog_discarded is triggered, which tries to set focus on form while lastActivatedFieldIndex is -1, as dialog is opened using mouse directly do not set focus back to form widget if lastActivatedFieldIndex is -1 task-2031706 closes odoo/odoo#34684 Signed-off-by: VincentSchippefilt --- addons/web/static/src/js/views/form/form_controller.js | 9 ++++++--- addons/web/static/src/js/views/form/form_renderer.js | 7 +++++-- addons/web/static/src/js/views/view_dialogs.js | 18 ++++++++++++++---- 3 files changed, 25 insertions(+), 9 deletions(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/views/form/form_controller.js b/addons/web/static/src/js/views/form/form_controller.js index 434e2095a8e..e3085b1379d 100644 --- a/addons/web/static/src/js/views/form/form_controller.js +++ b/addons/web/static/src/js/views/form/form_controller.js @@ -596,9 +596,12 @@ var FormController = BasicController.extend({ * @private * @param {OdooEvent} event */ - _onFormDialogDiscarded: function(e) { - e.stopPropagation(); - this.renderer.focusLastActivatedWidget(); + _onFormDialogDiscarded: function(ev) { + ev.stopPropagation(); + var isFocused = this.renderer.focusLastActivatedWidget(); + if (ev.data.callback) { + ev.data.callback(_.str.toBool(isFocused)); + } }, /** * Opens a one2many record (potentially new) in a dialog. This handler is diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js index 2bf3c29197c..518791a6be9 100644 --- a/addons/web/static/src/js/views/form/form_renderer.js +++ b/addons/web/static/src/js/views/form/form_renderer.js @@ -176,8 +176,11 @@ var FormRenderer = BasicRenderer.extend({ * field. */ focusLastActivatedWidget: function () { - this._activateNextFieldWidget(this.state, this.lastActivatedFieldIndex - 1, - { noAutomaticCreate: true }); + if (this.lastActivatedFieldIndex !== -1) { + return this._activateNextFieldWidget(this.state, this.lastActivatedFieldIndex - 1, + { noAutomaticCreate: true }); + } + return false; }, /** * returns the active tab pages for each notebook diff --git a/addons/web/static/src/js/views/view_dialogs.js b/addons/web/static/src/js/views/view_dialogs.js index 3df17bbf155..c7360c81d02 100644 --- a/addons/web/static/src/js/views/view_dialogs.js +++ b/addons/web/static/src/js/views/view_dialogs.js @@ -238,8 +238,13 @@ var FormViewDialog = ViewDialog.extend({ * @override */ _focusOnClose: function() { - this.trigger_up('form_dialog_discarded'); - return true; + var isFocusSet = false; + this.trigger_up('form_dialog_discarded', { + callback: function (isFocused) { + isFocusSet = isFocused; + }, + }); + return isFocusSet; }, /** @@ -466,8 +471,13 @@ var SelectCreateDialog = ViewDialog.extend({ * @override */ _focusOnClose: function() { - this.trigger_up('form_dialog_discarded'); - return true; + var isFocusSet = false; + this.trigger_up('form_dialog_discarded', { + callback: function (isFocused) { + isFocusSet = isFocused; + }, + }); + return isFocusSet; }, //-------------------------------------------------------------------------- // Handlers -- cgit v1.2.3 From 04a600486e63397fa6295d7715613bd4b0f0acde Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 19 Jul 2019 12:04:12 +0000 Subject: [FIX] web: remove lazyloaded controller from stack ... if the current action can't be executed. Let's assume a form view for a record with a multicompany ir.rule. If the user switches to another company, the webclient is reloaded, but he doesn't have access to that record anymore. In this case, he is redirected to the Home menu. Before this rev., when he clicked on an app in this situation, it crashed. This was due to a leftover reference of the failed action (the lazyloaded, multi-record controller) in the controller stack. closes odoo/odoo#34994 Signed-off-by: VincentSchippefilt --- addons/web/static/src/js/chrome/action_manager_act_window.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js') 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 8b3ff339ded..123f41965b3 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 @@ -285,6 +285,7 @@ ActionManager.include({ } var lazyViewDef; + var lazyControllerID; if (lazyView) { // if the main view is lazy-loaded, its (lazy-loaded) controller is inserted // into the controller stack (so that breadcrumbs can be correctly computed), @@ -294,6 +295,7 @@ ActionManager.include({ // this controller being lazy-loaded, this call is actually sync lazyViewDef = self._createViewController(action, lazyView.type, {}, {lazy: true}) .then(function (lazyLoadedController) { + lazyControllerID = lazyLoadedController.jsID; self.controllerStack.push(lazyLoadedController.jsID); }); } @@ -312,7 +314,13 @@ ActionManager.include({ action.controllerID = controller.jsID; return self._executeAction(action, options); }) - .fail(self._destroyWindowAction.bind(self, action)); + .fail(function () { + if (lazyControllerID) { + var index = self.controllerStack.indexOf(lazyControllerID); + self.controllerStack = self.controllerStack.slice(0, index); + } + self._destroyWindowAction(action); + }); }); }, /** -- cgit v1.2.3