[CLEAN] message_post_api: removed unnecessary type arg (posting is a comment).

bzr revid: tde@openerp.com-20121029101230-x39pep9p5edd54ml
This commit is contained in:
Thibault Delavallée 2012-10-29 11:12:30 +01:00
parent cbf55bc07d
commit a2d3d1df80
3 changed files with 4 additions and 7 deletions

View File

@ -707,13 +707,12 @@ class mail_thread(osv.AbstractModel):
return mail_message.create(cr, uid, values, context=context) return mail_message.create(cr, uid, values, context=context)
def message_post_api(self, cr, uid, thread_id, body='', subject=False, type='notification', def message_post_api(self, cr, uid, thread_id, body='', subject=False, parent_id=False, attachment_ids=None, context=None):
parent_id=False, attachment_ids=None, context=None):
""" Wrapper on message_post, used only in Chatter (JS). The purpose is """ Wrapper on message_post, used only in Chatter (JS). The purpose is
to handle attachments. to handle attachments.
# TDE FIXME: body is plaintext: convert it into html # TDE FIXME: body is plaintext: convert it into html
""" """
new_message_id = self.message_post(cr, uid, thread_id=thread_id, body=body, subject=subject, type=type, new_message_id = self.message_post(cr, uid, thread_id=thread_id, body=body, subject=subject, type='comment',
subtype='mail.mt_comment', parent_id=parent_id, context=context) subtype='mail.mt_comment', parent_id=parent_id, context=context)
# HACK FIXME: 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

View File

@ -111,8 +111,7 @@ class res_users(osv.Model):
alias_pool.unlink(cr, uid, alias_ids, context=context) alias_pool.unlink(cr, uid, alias_ids, context=context)
return res return res
def message_post_api(self, cr, uid, thread_id, body='', subject=False, type='notification', def message_post_api(self, cr, uid, thread_id, body='', subject=False, parent_id=False, attachment_ids=None, context=None):
parent_id=False, attachment_ids=None, context=None, **kwargs):
""" Redirect the posting of message on res.users to the related partner. """ Redirect the posting of message on res.users to the related partner.
This is done because when giving the context of Chatter on the This is done because when giving the context of Chatter on the
various mailboxes, we do not have access to the current partner_id. various mailboxes, we do not have access to the current partner_id.
@ -124,7 +123,7 @@ class res_users(osv.Model):
thread_id = thread_id[0] thread_id = thread_id[0]
partner_id = self.pool.get('res.users').read(cr, uid, thread_id, ['partner_id'], context=context)['partner_id'][0] partner_id = self.pool.get('res.users').read(cr, uid, thread_id, ['partner_id'], context=context)['partner_id'][0]
return self.pool.get('res.partner').message_post_api(cr, uid, partner_id, body=body, subject=subject, return self.pool.get('res.partner').message_post_api(cr, uid, partner_id, body=body, subject=subject,
type=type, parent_id=parent_id, attachment_ids=attachment_ids, context=context, **kwargs) parent_id=parent_id, attachment_ids=attachment_ids, context=context)
def message_post(self, cr, uid, thread_id, context=None, **kwargs): def message_post(self, cr, uid, thread_id, context=None, **kwargs):
""" Redirect the posting of message on res.users to the related partner. """ Redirect the posting of message on res.users to the related partner.

View File

@ -358,7 +358,6 @@ openerp.mail = function (session) {
this.context.default_res_id, this.context.default_res_id,
mail.ChatterUtils.get_text2html(body), mail.ChatterUtils.get_text2html(body),
false, false,
'comment',
this.context.default_parent_id, this.context.default_parent_id,
attachments, attachments,
this.parent_thread.context this.parent_thread.context