From 0bedc14c124ef20a1d11b4c5c5fdc746bad02f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 23 Aug 2016 14:38:57 +0200 Subject: [PATCH] [IMP] mail, various: send email to assigned people When a user is assigned to a model on a user_id field an email is sent to him containing a link to the document. This way the user is warned he is now responsible of the task / issue / lead / ... --- addons/mail/models/mail_thread.py | 11 +++++++++-- addons/mail/views/mail_templates.xml | 12 ++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 502831183c7..0e94aee9992 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -2004,10 +2004,17 @@ class MailThread(models.AbstractModel): """ if not partner_ids: return - for record_id in self.ids: + for record in self: + record.message_post_with_view( + 'mail.message_user_assigned', + composition_mode='mass_mail', + partner_ids=[(4, pid) for pid in partner_ids], + auto_delete=True, + auto_delete_message=True, + subtype_id=self.env.ref('mail.mt_note').id) messages = self.env['mail.message'].sudo().search([ ('model', '=', self._name), - ('res_id', '=', record_id), + ('res_id', '=', record.id), ('subtype_id', '!=', False), ('subtype_id.internal', '=', False)], limit=1) if messages: diff --git a/addons/mail/views/mail_templates.xml b/addons/mail/views/mail_templates.xml index 192486b6eaa..97d9c834821 100644 --- a/addons/mail/views/mail_templates.xml +++ b/addons/mail/views/mail_templates.xml @@ -38,5 +38,17 @@

+ +