From d179a94da6a7b99417cab10073ebb3505cb31142 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Thu, 26 Nov 2015 10:25:15 +0100 Subject: [FIX] web: list_view, context when doing name_get call in m2m was not compute correctly this is a backport of commit fd56268c6ca4e8a6f94f16de9129bd12be87303f --- addons/web/static/src/js/view_list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 5e7a2ce812f..95c02980f5c 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1081,7 +1081,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. ids = value; } new instance.web.Model(column.relation) - .call('name_get', [ids, this.dataset.context]).done(function (names) { + .call('name_get', [ids, this.dataset.get_context()]).done(function (names) { // FIXME: nth horrible hack in this poor listview record.set(column.id + '__display', _(names).pluck(1).join(', ')); -- cgit v1.2.3 From e39c26c8ffd90f4e4f201c9fc95e370ab4ceb066 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Tue, 1 Dec 2015 10:41:11 +0100 Subject: [FIX] web: X2Many list views: don't display action buttons --- addons/web/static/src/js/views/form_relational_widgets.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/web/static/src/js') 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 7c3048ee24b..a4e900c6636 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -759,6 +759,7 @@ var FieldX2Many = AbstractManyField.extend({ } if(view.view_type === "list") { _.extend(view.options, { + action_buttons: false, // to avoid 'Save' and 'Discard' buttons to appear in X2M fields addable: null, selectable: self.multi_selection, sortable: true, -- cgit v1.2.3 From 0ba248aedaa7ae52462521c05cb8329773939ad6 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 1 Dec 2015 12:31:49 +0100 Subject: [FIX] web: prevent default value changes Load record use values as dataset and change object value (for eg: add virtual id in the default value object). --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index d6800f8cd45..457786ea8c0 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -368,7 +368,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM var keys = _.keys(this.fields_view.fields); if (keys.length) { return this.dataset.default_get(keys).then(function(r) { - self.trigger('load_record', r); + self.trigger('load_record', _.clone(r)); }); } return self.trigger('load_record', {}); -- cgit v1.2.3 From 1cd03ed7fe4b68df256e54bc72fe12841726a980 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 1 Dec 2015 13:10:58 +0100 Subject: [FIX] web: one2many set_value must use dataset last_default_get as default values --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 457786ea8c0..5e1e3b9ad8e 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4243,7 +4243,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ switch (command[0]) { case commands.CREATE: obj['id'] = _.uniqueId(self.dataset.virtual_id_prefix); - obj.defaults = {}; + obj.defaults = self.dataset.last_default_get; self.dataset.to_create.push(obj); self.dataset.cache.push(_.extend(_.clone(obj), {values: _.clone(command[2])})); ids.push(obj.id); -- cgit v1.2.3 From f814dd9908355465dd03735f4589dd1697b3658a Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Tue, 1 Dec 2015 00:15:14 +0100 Subject: [FIX] web, openerp: debug mode now works without referer In some cases the Referer HTTP header may be missing or stripped by a proxy, browser extension or anti-virus. This breaks debug mode because it was solely relying on the Referer header. Introducing an explicit X-Debug-Mode header for RPC calls allows for an alternative method that works even when the Referer is missing. This won't work in all cases, e.g. for direct $.ajax calls, for example. Closes #9824 --- addons/web/static/src/js/framework/session.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/framework/session.js b/addons/web/static/src/js/framework/session.js index 3ae6ddb6649..7eae8b20a65 100644 --- a/addons/web/static/src/js/framework/session.js +++ b/addons/web/static/src/js/framework/session.js @@ -335,6 +335,11 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { var self = this; options = _.clone(options || {}); var shadow = options.shadow || false; + options.headers = _.extend({}, options.headers) + if (odoo.debug) { + options.headers["X-Debug-Mode"] = true; + } + delete options.shadow; return self.check_session_id().then(function() { @@ -350,18 +355,14 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { if (self.origin_server) { fct = ajax.jsonRpc; if (self.override_session) { - options.headers = _.extend({}, options.headers, { - "X-Openerp-Session-Id": self.override_session ? self.session_id || '' : '' - }); + options.headers["X-Openerp-Session-Id"] = self.session_id || ''; } } else if (self.use_cors) { fct = ajax.jsonRpc; url = self.url(url, null); options.session_id = self.session_id || ''; if (self.override_session) { - options.headers = _.extend({}, options.headers, { - "X-Openerp-Session-Id": self.override_session ? self.session_id || '' : '' - }); + options.headers["X-Openerp-Session-Id"] = self.session_id || ''; } } else { fct = ajax.jsonpRpc; -- cgit v1.2.3 From bcd7273ba889b8e146355a6fbb1b16f8438efa1e Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Tue, 1 Dec 2015 14:38:09 +0100 Subject: [FIX] web: pivot axis switch groupby field In ee0caa246 we solved some issue when a field was used in a "group by" filter, but was not considered "groupable" (which does not resolve related field in their related model to see if they fit the bill). This was fine, but this has to be also taken into account when these group by are applied to columns, which is possible by switching x and y axis. opw-647401 --- addons/web/static/src/js/view_pivot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/view_pivot.js b/addons/web/static/src/js/view_pivot.js index 8dbfb3360e1..b9e3f07cb00 100644 --- a/addons/web/static/src/js/view_pivot.js +++ b/addons/web/static/src/js/view_pivot.js @@ -558,7 +558,7 @@ instance.web.PivotView = instance.web.View.extend({ display_total = this.main_col.width > 1; var groupby_labels = _.map(this.main_col.groupbys, function (gb) { - return self.groupable_fields[gb.split(':')[0]].string; + return self.fields[gb.split(':')[0]].string; }); for (i = 0; i < headers.length; i++) { -- cgit v1.2.3 From f58450dbe923c8868f552016131da4d90be0daa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 2 Dec 2015 11:04:12 +0100 Subject: [FIX] web_kanban: properly removes nvd3 tooltips with the recent update of nvd3 to the last version, we fixed a lot of tooltip issues, but we introduced at least a new problem: when a view is detached from the dom with a visible tooltip, it no longer is cleaned up. In this commit, we simply remove all nvtooltips when we detach a kanban view (necessary because dashboards inherits from kanban). This is not really an elegant way to solve the issue, but at least it works. any improvement is welcome. --- addons/web/static/src/js/views/graph_view.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/views/graph_view.js b/addons/web/static/src/js/views/graph_view.js index 8a604640fc9..f8f1bba909a 100644 --- a/addons/web/static/src/js/views/graph_view.js +++ b/addons/web/static/src/js/views/graph_view.js @@ -19,6 +19,10 @@ var GraphView = View.extend({ icon: 'fa-bar-chart', view_type: 'graph', + on_detach_callback: function () { + $('body > .nvtooltip').remove(); + }, + init: function(parent, dataset, view_id, options) { this._super(parent, dataset, view_id, options); -- cgit v1.2.3 From 4d8ec5f9317a824a1d6f705ad204d4edc178b1c8 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 2 Dec 2015 11:02:17 +0100 Subject: [FIX] web: readonly fields not transferred from dialog to 2many field 'write_function' transfer the options to 'write' method from the popup form Steps to reproduce: 1. Create custom model to add a product quantity on hand(readonly) field on stock.move 2. Show this field on Warehouse>All operations>Create a Transfer> Create: Internal Moves 3. Add a Internal Move, then open it again, the quantity on hand field's value show 0. But change the product, the value is correct. --- addons/web/static/src/js/view_form.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 5e1e3b9ad8e..e660d31292e 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4376,7 +4376,7 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({ }); }, write_function: function(id, data, options) { - return self.o2m.dataset.write(id, data, {}).done(function() { + return self.o2m.dataset.write(id, data, options).done(function() { self.o2m.reload_current_view(); }); }, @@ -4496,8 +4496,8 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ var pop = new instance.web.form.FormOpenPopup(self); pop.show_element(self.o2m.field.relation, id, self.o2m.build_context(), { title: _t("Open: ") + self.o2m.string, - write_function: function(id, data) { - return self.o2m.dataset.write(id, data, {}).done(function() { + write_function: function(id, data, options) { + return self.o2m.dataset.write(id, data, options).done(function() { self.o2m.reload_current_view(); }); }, @@ -5115,7 +5115,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( pop.show_element(self.field.relation, id, self.build_context(), { title: _t("Open: ") + self.string, write_function: function(id, data, options) { - return self.dataset.write(id, data, {}).done(function() { + return self.dataset.write(id, data, options).done(function() { self.render_value(); }); }, -- cgit v1.2.3