From bcbf4316e669438e9b07c1da744667f689c123f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 19 Jul 2016 13:03:35 +0200 Subject: [FIX] models, mail, *: fix access action crash due to one / multi conversion get_formview_action and get_formview_id are methods used notably in a redirection called from a mail controller used in notification emails. Those methods however are defined as cr, uid, id and are interpreted as api.one when called by a new-api style method. With modules being converted into the new API, those methods are called as api.one and the result is encapsulated into a list. To avoid having to take the first element of the returned list we decided to simplify the call chain and migrate the methods as multi methods, using ids instead of id. Various addons have been updated accordingly. A temporary support of ids being an int / long has been added to avoid conflict with calls using id (for example if javascript is not updated). --- addons/web/static/src/js/views/form_relational_widgets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (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 6274f0bc087..6e565a07a2d 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -142,7 +142,7 @@ var FieldMany2One = common.AbstractField.extend(common.CompletionFieldMixin, com } var context = self.build_context().eval(); var model_obj = new Model(self.field.relation); - model_obj.call('get_formview_id', [self.get("value"), context]).then(function(view_id){ + model_obj.call('get_formview_id', [[self.get("value")], context]).then(function(view_id){ var pop = new common.FormViewDialog(self, { res_model: self.field.relation, res_id: self.get("value"), @@ -362,7 +362,7 @@ var FieldMany2One = common.AbstractField.extend(common.CompletionFieldMixin, com execute_formview_action: function() { var self = this; var context = self.build_context().eval(); - (new Model(self.field.relation)).call('get_formview_action', [self.get("value"), context]).then(function(action) { + (new Model(self.field.relation)).call('get_formview_action', [[self.get("value")], context]).then(function(action) { self.do_action(action); }); }, -- cgit v1.2.3