From 995b99698df7512f56fd0e18a3db76dbc67909ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 2 Apr 2012 15:44:36 +0200 Subject: [PATCH] [TMP] Added temp message_add_note method, that will replace message_append_note to eliminate redundancy in subjects through the addons. bzr revid: tde@openerp.com-20120402134436-a6kgx7xvg2i0g8f1 --- addons/mail/mail_thread.py | 7 ++++++- addons/mail/static/src/js/mail.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) 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)); }, });