From f06981598095f7b68b9f3d0d50ec194b6bfb8a07 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 18 Apr 2016 12:00:49 +0200 Subject: [PATCH] [FIX] mail: chatter: dialog's form view not ready Since rev. 002660a9, form views are instantiated with their fields_view. This had an impact in FormViewDialog as the inner form view instantiation was made asynchronous. Unfortunately, an event handler was set on this form view in the chatter, and it produced a traceback as the form view wasn't instantiated yet. --- addons/mail/static/src/js/chatter.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/mail/static/src/js/chatter.js b/addons/mail/static/src/js/chatter.js index 271c3e9fa51..0074698fef9 100644 --- a/addons/mail/static/src/js/chatter.js +++ b/addons/mail/static/src/js/chatter.js @@ -187,11 +187,13 @@ var ChatterComposer = composer.BasicComposer.extend({ dialog.on('closed', self, function () { deferred.resolve(); }); - dialog.view_form.on('on_button_cancel', self, function () { - names_to_remove.push(partner_name); - if (partner_id) { - recipient_ids_to_remove.push(partner_id); - } + dialog.opened().then(function () { + dialog.view_form.on('on_button_cancel', self, function () { + names_to_remove.push(partner_name); + if (partner_id) { + recipient_ids_to_remove.push(partner_id); + } + }); }); }); $.when.apply($, emails_deferred).then(function () {