From d3609f7f19a5ec51d9add5add3c5d8befdd87173 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Wed, 12 Oct 2016 18:03:43 +0200 Subject: [FIX] web,crm: list view, don't fallback on group_operator declared in python Partial revert of odoo/odoo@633780a --- addons/web/static/src/js/view_list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index a7686f8eebc..a16dddcbf91 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -2210,7 +2210,7 @@ instance.web.list.Column = instance.web.Class.extend({ } var aggregation_func = (this.sum && 'sum') || (this.avg && 'avg') || - (this.max && 'max') || (this.min && 'min') || this.group_operator; + (this.max && 'max') || (this.min && 'min'); if (!aggregation_func) { return {}; -- cgit v1.2.3 From a7b976c70455e9bb48f827cd45f3c1dc4887fac7 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Wed, 12 Oct 2016 22:15:22 +0200 Subject: [FIX] web: browser's back button while in the same action When you browse through the views of an action and then hit the back button, the view does not change. For example, go to the customers kanban, click on a customer, hit back, you're still in the customer form view. related rev: 46857d267b46c6ae91817231f8293403117bb75e `do_load_state` is called when you hit f5 or press the back button on your browser. The related rev took care of fixing the ugly part that make the webclient goes trough the multi record view then the mono record view when you hit f5 on a mono record view. In this context, it removed the code in view manager's `do_load_state` that switched the mode of the action if it isn't the same the one the web client is trying to restore from the state (because now the correct mode is loaded). However, if you hit the back button while the previous view is in the same action, it obviously doesn't switch the mode anymore and you're facing the same view. The issue is fixed by restoring the switch_mode in the view manager's `do_load_state` (without its oudated comment). --- addons/web/static/src/js/view_manager.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_manager.js b/addons/web/static/src/js/view_manager.js index 6a8a162e144..ec7ce95313a 100644 --- a/addons/web/static/src/js/view_manager.js +++ b/addons/web/static/src/js/view_manager.js @@ -458,6 +458,9 @@ var ViewManager = Widget.extend(ControlPanelMixin, { } }, do_load_state: function(state, warm) { + if (state.view_type && state.view_type !== this.active_view.type) { + this.switch_mode(state.view_type, true); + } this.active_view.controller.do_load_state(state, warm); }, }); -- cgit v1.2.3 From 5abe76c2d27a6ab07eebb382205c841acf32c551 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Wed, 12 Oct 2016 22:04:43 +0200 Subject: [FIX] web: clear_uncommitted_changes on browser's back button This is done by guarding the `on_hashchange` evant handler with the `clear_uncommitted_changes` function. Note that the url has already changed when we are in this handler, so we make sure to restore the old url when the user chose to continue its edition. --- addons/web/static/src/js/web_client.js | 36 ++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/web_client.js b/addons/web/static/src/js/web_client.js index 48216f9c0a3..5498e0a7474 100644 --- a/addons/web/static/src/js/web_client.js +++ b/addons/web/static/src/js/web_client.js @@ -285,20 +285,32 @@ var WebClient = Widget.extend({ } }, on_hashchange: function(event) { + if (this._ignore_hashchange) { + this._ignore_hashchange = false; + return; + } + var self = this; - var stringstate = event.getState(false); - if (!_.isEqual(this._current_state, stringstate)) { - var state = event.getState(true); - if(!state.action && state.menu_id) { - self.menu.is_bound.done(function() { - self.menu.menu_click(state.menu_id); - }); - } else { - state._push_me = false; // no need to push state back... - this.action_manager.do_load_state(state, !!this._current_state); + this.clear_uncommitted_changes().then(function () { + var stringstate = event.getState(false); + if (!_.isEqual(self._current_state, stringstate)) { + var state = event.getState(true); + if(!state.action && state.menu_id) { + self.menu.is_bound.done(function() { + self.menu.menu_click(state.menu_id); + }); + } else { + state._push_me = false; // no need to push state back... + self.action_manager.do_load_state(state, !!self._current_state); + } } - } - this._current_state = stringstate; + self._current_state = stringstate; + }, function () { + if (event) { + self._ignore_hashchange = true; + window.location = event.originalEvent.oldURL; + } + }); }, do_push_state: function(state) { this.set_title(state.title); -- cgit v1.2.3 From c63c225274c4e6b0647e24fda91f72de4f046430 Mon Sep 17 00:00:00 2001 From: Devendra Kavthekar Date: Thu, 13 Oct 2016 19:31:22 +0530 Subject: [FIX] web: is_false() for reference field widget. (#9335) In the widget, the value of reference field is a pair `[val1, val2]`. When the field is blank, its value is `[false,false]`, thus checking `[false,false] === false` never succeeds, and this breaks the check for required fields. --- addons/web/static/src/js/views/form_widgets.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js index 3b630d4232d..15acd788263 100644 --- a/addons/web/static/src/js/views/form_widgets.js +++ b/addons/web/static/src/js/views/form_widgets.js @@ -1152,6 +1152,9 @@ var FieldReference = common.AbstractField.extend(common.ReinitializeFieldMixin, this.m2o.do_toggle(!!this.get('value')[0]); this.reference_ready = true; }, + is_false: function() { + return this.get('value')[0] == false || this.get('value')[1] == false; + }, }); var FieldBinary = common.AbstractField.extend(common.ReinitializeFieldMixin, { -- cgit v1.2.3 From a75961364b2c7055a044b87ceba435dc829ce8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Mon, 17 Oct 2016 15:46:38 +0200 Subject: [FIX] web: properly apply styles attribute to form fields The form widgets did not apply the 'style' attribute to the result of the rendering. Because of that, many small adjustment were no longer possible. This commit makes sure that it is indeed done. --- addons/web/static/src/js/views/form_common.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/views/form_common.js b/addons/web/static/src/js/views/form_common.js index f869842415c..6752885f372 100644 --- a/addons/web/static/src/js/views/form_common.js +++ b/addons/web/static/src/js/views/form_common.js @@ -430,6 +430,7 @@ var FormWidget = Widget.extend(InvisibilityChangerMixin, { this.process_modifiers(); this._super(); this.$el.addClass(this.node.attrs["class"] || ""); + this.$el.attr('style', this.node.attrs.style); }, destroy: function() { $.fn.tooltip('destroy'); -- cgit v1.2.3 From 5da0ae9b0498e829744487e72d870639b021729f Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Mon, 17 Oct 2016 15:12:33 +0200 Subject: [FIX] web: add min-height on notebook Moved from enterprise --- addons/web/static/src/less/form_view.less | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/less/form_view.less b/addons/web/static/src/less/form_view.less index e992ab5a748..7d870122502 100644 --- a/addons/web/static/src/less/form_view.less +++ b/addons/web/static/src/less/form_view.less @@ -460,6 +460,15 @@ } } } + + // Notebooks + .o_notebook { + .nav-tabs { + > .tab-pane { + min-height: 100px; + } + } + } } // Overriden style when form view in modal -- cgit v1.2.3 From e05dba357ee44151db9449af4cfdf0d6c36d5dca Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Mon, 17 Oct 2016 13:55:34 +0200 Subject: [FIX] web: one2many displayed even if no data. Before this commit, the one2many widget was not displayed if no data. That make some form (notebook) empty while the user don't click en edit to see the widget appear. Eg: stock picking 'Initial Demand' tab Courtesy of @ged-odoo --- addons/web/static/src/js/views/form_relational_widgets.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index dd4c4fb0fb6..00640696b41 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -1275,6 +1275,9 @@ var FieldOne2Many = FieldX2Many.extend({ return self.mutex.def; }); }, + is_false: function() { + return false; + }, }); var Many2ManyListView = X2ManyListView.extend({ -- cgit v1.2.3