From: Thibault Delavallée Date: Thu, 25 Oct 2012 07:50:36 +0000 (+0200) Subject: [FIX] mail_thread: removed hack 'posting on res.partner without thread_id is posting... X-Git-Tag: 7.0-server~1048^2~97^2~16 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=d46263525340104895e4d2439ec7e581545a63f1;p=odoo%2Fodoo.git [FIX] mail_thread: removed hack 'posting on res.partner without thread_id is posting on its own partner -> please avoid having hacks without an explanation about why it is here. We will see if this changes something. Also fixed parent_id given to the message_read that follows the message_post. bzr revid: tde@openerp.com-20121025075036-tsqen9c10ft1er0l --- diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 04da686..094cebd 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -692,14 +692,10 @@ class mail_thread(osv.AbstractModel): def message_post_api(self, cr, uid, thread_id, body='', subject=False, type='notification', subtype=None, parent_id=False, attachments=None, context=None, **kwargs): # TDE FIXME: body is plaintext: convert it into html - # when writing on res.partner, without specific thread_id -> redirect to the user's partner - if self._name == 'res.partner' and not thread_id: - thread_id = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'], context=context)['partner_id'][0] - new_message_id = self.message_post(cr, uid, thread_id=thread_id, body=body, subject=subject, type=type, subtype=subtype, parent_id=parent_id, context=context) - # Chatter: attachments linked to the document (not done JS-side), load the message + # HACK FIXME: Chatter: attachments linked to the document (not done JS-side), load the message if attachments: ir_attachment = self.pool.get('ir.attachment') mail_message = self.pool.get('mail.message') @@ -708,7 +704,7 @@ class mail_thread(osv.AbstractModel): ir_attachment.write(cr, SUPERUSER_ID, attachment_ids, {'res_model': self._name, 'res_id': thread_id}, context=context) mail_message.write(cr, SUPERUSER_ID, [new_message_id], {'attachment_ids': [(6, 0, [pid for pid in attachment_ids])]}, context=context) - new_message = self.pool.get('mail.message').message_read(cr, uid, [new_message_id], context=context) + new_message = self.pool.get('mail.message').message_read(cr, uid, [new_message_id], parent_id=parent_id, context=context) return new_message #------------------------------------------------------