From a37bad205b13cec4f19f8e84e28801278e3e36ca Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 26 May 2014 17:05:02 +0200 Subject: [FIX] web: on launching ir_actions_act_window, reset the active_* params if the target is current This commit is related to 8d496399336b4a97200f6f7b5907ed1c7b99970c and b88755c4317ac61fc8d0533162d4ed19082f3fab When hitting buttons of type object, the active_model and active_id(s) were kept, and, therefore, when calling a feature using the active* args, this feature used the active* args from the previous action. Nevertheless, concerning wizards, the active* args should be indeed the active* args of the previous action, as wizards expects to have the active* args from the previous action. Thus, we reset these active* args only when this is not a wizard (target === 'current') For example, from a sales order, hit the 'view invoice' button, and on the invoice, hit the 'send by email' button: The active_id in the send by email wizard were the id of the sale order, not of the invoice --- addons/web/static/src/js/views.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index dc9f706d40e..228a0b3e8f2 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -436,6 +436,16 @@ instance.web.ActionManager = instance.web.Widget.extend({ ir_actions_act_window: function (action, options) { var self = this; + if (action.target === 'current'){ + action.context['active_model'] = action.res_model; + if (action.res_id){ + action.context['active_id'] = action.res_id; + action.context['active_ids'] = [action.res_id]; + } else{ + delete action.context['active_id']; + delete action.context['active_ids']; + } + } return this.ir_actions_common({ widget: function () { return new instance.web.ViewManagerAction(self, action); }, action: action, -- cgit v1.2.3 From 477fa85e559b227cfb7d1ae53588e0360084a0ac Mon Sep 17 00:00:00 2001 From: Mohammed Shekha Date: Tue, 27 May 2014 10:10:06 +0530 Subject: [FIX]Fixe the issue o2m record duplication. --- addons/web/static/src/js/view_form.js | 1 + 1 file changed, 1 insertion(+) (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 7a38f0be2be..403a4b0d7c9 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3949,6 +3949,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ return $.when(); }).done(function () { if (!self.o2m.options.reload_on_button) { + self.o2m.dataset.reset_ids([]); self.handle_button(name, id, callback); }else { self.handle_button(name, id, function(){ -- cgit v1.2.3 From a26a0e6d302db793df887811be6e16dfa28cae31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 27 May 2014 13:31:12 +0200 Subject: [FIX] web: chardomain widget: fixed selection of some records in a list (bad domain formatting), fixed domain evaluation tah is done server-side instead of through a stringigy. --- addons/web/static/src/js/view_form.js | 6 +++--- 1 file changed, 3 insertions(+), 3 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 2a495c397e0..7a869d72d55 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2481,6 +2481,7 @@ instance.web.form.FieldCharDomain = instance.web.form.AbstractField.extend(insta this.$('.select_records').on('click', self.on_click); }, on_click: function(ev) { + event.preventDefault(); var self = this; var model = this.options.model || this.field_manager.get_field_value(this.options.model_field); this.pop = new instance.web.form.SelectCreatePopup(this); @@ -2499,15 +2500,14 @@ instance.web.form.FieldCharDomain = instance.web.form.AbstractField.extend(insta }); } else { - var domain = ["id", "in", element_ids]; + var domain = [["id", "in", element_ids]]; var domain_done = $.Deferred().resolve(domain); } $.when(domain_done).then(function (domain) { var domain = self.pop.dataset.domain.concat(domain || []); - self.set_value(JSON.stringify(domain)) + self.set_value(domain); }); }); - event.preventDefault(); }, }); -- cgit v1.2.3 From 26cb2089032af0f11578f1997544ff1deef1e25e Mon Sep 17 00:00:00 2001 From: Mohammed Shekha Date: Tue, 27 May 2014 19:35:09 +0530 Subject: [FIX]Refixed the issue of o2m record duplication --- addons/web/static/src/js/view_form.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 403a4b0d7c9..ce4246708b4 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3948,8 +3948,11 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ else return $.when(); }).done(function () { - if (!self.o2m.options.reload_on_button) { - self.o2m.dataset.reset_ids([]); + var ds = self.o2m.dataset; + var cached_records = _.any([ds.to_create, ds.to_delete, ds.to_write], function(value) { + return value.length; + }); + if (!self.o2m.options.reload_on_button && !cached_records) { self.handle_button(name, id, callback); }else { self.handle_button(name, id, function(){ -- cgit v1.2.3