[IMP] mail_message_copy_in_partner:
new message is a note without recipients
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
mail_message_copy_in_partner
|
||||
=================
|
||||
If current model has partner_id field, all messages will be copied in partner's chatter
|
||||
New message is a note without recipients
|
||||
|
||||
|
||||
Installation
|
||||
|
@@ -8,7 +8,17 @@ class MailThread(models.AbstractModel):
|
||||
def message_post(self, body='', **kwargs):
|
||||
#send message to related partner
|
||||
if hasattr(self, 'partner_id') and self.partner_id:
|
||||
msg = _('<b>[%(object)s]</b> %(body)s',object=self._get_html_link(), body=body)
|
||||
self.partner_id.message_post(body=msg, **kwargs)
|
||||
msg = _('<b>[%(object)s]</b> %(body)s',object=self._get_html_link(), body=body)
|
||||
|
||||
new_kwargs = kwargs.copy()
|
||||
|
||||
#new message is a note
|
||||
new_kwargs['subtype_xmlid'] = "mail.mt_note"
|
||||
|
||||
#do not send anything
|
||||
new_kwargs['partner_ids'] = []
|
||||
|
||||
self.partner_id.message_post(body=msg, **new_kwargs)
|
||||
|
||||
return super(MailThread, self).message_post(body=body, **kwargs)
|
||||
|
Reference in New Issue
Block a user