diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 6c62531ea52..0379955125a 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -659,7 +659,12 @@ class mail_thread(osv.osv): self.message_append_note(cr, uid, [id], message, context=context) # tmp stuff - def message_add_note(self, cr, uid, ids, body, subject=_('System notification'), subtype='html', parent_id=False, type='notification', context=None): + def message_add_note(self, cr, uid, ids, body, type='notification', parent_id=False, subject=False, subtype='html', context=None): + if not subject: + if type == 'notification': + subject = _('System notification on %s') % (self._name, fields.datetime.now()) + elif type == 'comment': + subject = _('Reply on %s at %s') % (self._name, fields.datetime.now()) return self.message_append(cr, uid, ids, subject, body_text=body, parent_id=parent_id, type=type, context=context) def message_append_note(self, cr, uid, ids, subject, body, parent_id=False, type='notification', context=None): diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index e616ebf4b4e..c736eadd85e 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -296,7 +296,7 @@ openerp.mail = function(session) { var comment_node = this.$element.find('textarea'); var body_text = comment_node.val(); comment_node.val(''); - return this.ds.call('message_append_note', [[this.params.res_id], 'Reply comment', body_text, this.params.parent_id, 'comment']).then( + return this.ds.call('message_add_note', [[this.params.res_id], body_text, 'comment', this.params.parent_id]).then( this.proxy('init_comments')); }, @@ -804,7 +804,7 @@ openerp.mail = function(session) { /** Action: Posts a comment */ do_comment: function () { var body_text = this.$element.find('textarea.oe_mail_wall_action_textarea').val(); - return this.ds_users.call('message_append_note', [[this.session.uid], 'Tweet', body_text, false, 'comment']).then( + return this.ds_users.call('message_add_note', [[this.session.uid], body_text, 'comment', false, 'Tweet', 'html']).then( this.init_and_fetch_comments(this.params.limit, 0)); }, });