From 7b0162847f6f194f0003c02632564c2c3f2ffbda Mon Sep 17 00:00:00 2001 From: Peter Hahn Date: Fri, 8 Jan 2016 09:59:17 +0100 Subject: [PATCH] Add message sent to objects chatter. --- web_widget_mail_send_odoo/README.rst | 3 ++ .../src/js/web_widget_mail_send_odoo.js | 28 +++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/web_widget_mail_send_odoo/README.rst b/web_widget_mail_send_odoo/README.rst index 695f69d1..e2342f7b 100644 --- a/web_widget_mail_send_odoo/README.rst +++ b/web_widget_mail_send_odoo/README.rst @@ -10,6 +10,9 @@ This module was written to provide a new widget for Email fields to replace the standard behaviour of displaying a 'mailto:' link with JS to open the internal Email wizard from Odoo for message composition. +The message you sent gets appended to the chatter as if you where using internal +mail functions of Odoo. + Usage ===== diff --git a/web_widget_mail_send_odoo/static/src/js/web_widget_mail_send_odoo.js b/web_widget_mail_send_odoo/static/src/js/web_widget_mail_send_odoo.js index 39704ed6..b905d426 100644 --- a/web_widget_mail_send_odoo/static/src/js/web_widget_mail_send_odoo.js +++ b/web_widget_mail_send_odoo/static/src/js/web_widget_mail_send_odoo.js @@ -41,18 +41,19 @@ instance.web.form.FieldEmailIntern = instance.web.form.FieldChar.extend({ if(partner){ var fm = self.field_manager self.do_action( - 'mail.action_email_compose_message_wizard',{ - additional_context:{ - default_partner_ids: [partner.id], - default_composition_mode: 'comment', - /* write to active model: - I think we do not want't this on res.partner? - Make this configurable? - - default_model: fm.dataset._model.name, - default_res_id: fm.datarecord.id, - */ - }} + 'mail.action_email_compose_message_wizard', { + additional_context: { + default_partner_ids: [partner.id], + default_composition_mode: 'comment', + // write to active model: + default_model: fm.dataset._model.name, + default_res_id: fm.datarecord.id, + }, + on_close: function(){ + /* Todo: refresh the chatter widget here + */ + }, + } ) } else { self.do_warn(_t("E-mail Error"), @@ -65,9 +66,6 @@ instance.web.form.FieldEmailIntern = instance.web.form.FieldChar.extend({ }, }); -// Todo: Do not replace the default widget by default, make this configurable -// or put in an extra module instance.web.form.widgets.add('email', 'instance.web.form.FieldEmailIntern') -//instance.web.form.widgets.add('email-intern', 'instance.web.form.FieldEmailIntern') })()