Thibault Delavallée (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-fetchmail-inbox-tde into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-fetchmail-inbox-tde/+merge/131936
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-fetchmail-inbox-tde/+merge/131936
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-fetchmail-inbox-tde.
=== modified file 'mail/res_partner.py'
--- mail/res_partner.py	2012-10-15 13:23:13 +0000
+++ mail/res_partner.py	2012-10-29 15:46:22 +0000
@@ -42,4 +42,21 @@
         'notification_email_send': lambda *args: 'comment'
     }
 
+    def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification',
+                        subtype=None, parent_id=False, attachments=None, context=None, **kwargs):
+        """ Override related to res.partner. In case of email message, set it as
+            private:
+            - add the target partner in the message partner_ids
+            - set thread_id as None, because this will trigger the 'private'
+                aspect of the message (model=False, res_is=False)
+        """
+        if isinstance(thread_id, (list, tuple)):
+            thread_id = thread_id[0]
+        if type == 'email':
+            partner_ids = kwargs.get('partner_ids', [])
+            partner_ids.append(thread_id)
+            kwargs['partner_ids'] = partner_ids
+            return super(res_partner_mail, self).message_post(cr, uid, False, body=body, subject=subject,
+                type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, **kwargs)
+
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to