[CLEAN] Misc code cleaning.
bzr revid: tde@openerp.com-20121221145247-qqd1a1morv99ooow
This commit is contained in:
parent
f922d9ea1f
commit
1ab87ddd67
|
@ -886,9 +886,9 @@ class mail_thread(osv.AbstractModel):
|
|||
|
||||
return mail_message.create(cr, uid, values, context=context)
|
||||
|
||||
def message_post_user_api(self, cr, uid, thread_id, body='', subject=False,
|
||||
parent_id=False, attachment_ids=None, extra_emails=None,
|
||||
context=None, content_subtype='plaintext', **kwargs):
|
||||
def message_post_user_api(self, cr, uid, thread_id, body='', parent_id=False,
|
||||
attachment_ids=None, extra_emails=None, content_subtype='plaintext',
|
||||
context=None, **kwargs):
|
||||
""" Wrapper on message_post, used for user input :
|
||||
- mail gateway
|
||||
- quick reply in Chatter (refer to mail.js), not
|
||||
|
@ -933,8 +933,8 @@ class mail_thread(osv.AbstractModel):
|
|||
# 1.B: handle body, message_type and message_subtype
|
||||
if content_subtype == 'plaintext':
|
||||
body = tools.plaintext2html(body)
|
||||
message_type = kwargs.pop('type', 'comment')
|
||||
message_subtype = kwargs.pop('subtype', 'mail.mt_comment')
|
||||
msg_type = kwargs.pop('type', 'comment')
|
||||
msg_subtype = kwargs.pop('subtype', 'mail.mt_comment')
|
||||
|
||||
# 2. Pre-processing: attachments
|
||||
# HACK TDE FIXME: Chatter: attachments linked to the document (not done JS-side), load the message
|
||||
|
@ -954,13 +954,12 @@ class mail_thread(osv.AbstractModel):
|
|||
ir_attachment.write(cr, SUPERUSER_ID, attachment_ids, {'res_model': model, 'res_id': thread_id}, context=context)
|
||||
else:
|
||||
attachment_ids = []
|
||||
attachment_ids = [(4, id) for id in attachment_ids]
|
||||
|
||||
# 3. Post message
|
||||
new_message_id = self.message_post(cr, uid, thread_id=thread_id, body=body, subject=subject,
|
||||
type=message_type, subtype=message_subtype, parent_id=parent_id,
|
||||
attachment_ids=[(4, id) for id in attachment_ids], partner_ids=partner_ids,
|
||||
context=context, **kwargs)
|
||||
return new_message_id
|
||||
return self.message_post(cr, uid, thread_id=thread_id, body=body,
|
||||
type=msg_type, subtype=msg_subtype, parent_id=parent_id,
|
||||
attachment_ids=attachment_ids, partner_ids=partner_ids, context=context, **kwargs)
|
||||
|
||||
#------------------------------------------------------
|
||||
# Followers API
|
||||
|
|
|
@ -127,16 +127,14 @@ class res_users(osv.Model):
|
|||
def message_post_user_api(self, cr, uid, thread_id, body='', context=None, **kwargs):
|
||||
""" Redirect the posting of message on res.users to the related partner.
|
||||
This is done because when giving the context of Chatter on the
|
||||
various mailboxes, we do not have access to the current partner_id.
|
||||
We therefore post on the user and redirect on its partner. """
|
||||
various mailboxes, we do not have access to the current partner_id. """
|
||||
partner_id = self._message_post_get_pid(cr, uid, thread_id, context=context)
|
||||
return self.pool.get('res.partner').message_post_user_api(cr, uid, partner_id, **kwargs)
|
||||
|
||||
def message_post(self, cr, uid, thread_id, context=None, **kwargs):
|
||||
""" Redirect the posting of message on res.users to the related partner.
|
||||
This is done because when giving the context of Chatter on the
|
||||
various mailboxes, we do not have access to the current partner_id.
|
||||
We therefore post on the user and redirect on its partner. """
|
||||
various mailboxes, we do not have access to the current partner_id. """
|
||||
partner_id = self._message_post_get_pid(cr, uid, thread_id, context=context)
|
||||
return self.pool.get('res.partner').message_post(cr, uid, partner_id, context=context, **kwargs)
|
||||
|
||||
|
|
Loading…
Reference in New Issue