diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 1c1e980e3ed..301657ba4c2 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -96,11 +96,24 @@ class mail_message_common(osv.osv_memory): continue result[message.id] = self.pool.get(message.model).name_get(cr, uid, [message.res_id], context=context)[0][1] return result - + + def name_get(self, cr, uid, ids, context=None): + res = [] + for message in self.browse(cr, uid, ids, context=context): + name = '' + if message.subject: + name = '%s: ' % (message.subject) + if message.body_text: + name = '%s%s ' % (name, message.body_text[0:20]) + if message.date: + name = '%s(%s)' % (name, message.date) + res.append((message.id, name)) + return res + _name = 'mail.message.common' _rec_name = 'subject' _columns = { - 'subject': fields.char('Subject', size=512, required=True), + 'subject': fields.char('Subject', size=512), 'model': fields.char('Related Document Model', size=128, select=1), 'res_id': fields.integer('Related Document ID', select=1), 'record_name': fields.function(get_record_name, type='string', string='Message Record Name', diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index e0f2bfaf455..d0af1ed8841 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -746,13 +746,8 @@ class mail_thread(osv.osv): self.message_append_note(cr, uid, [id], 'res.log', message, context=context) def message_append_note(self, cr, uid, ids, subject=None, body=None, parent_id=False, type='notification', subtype='html', context=None): - if subject is None: - if type == 'notification': - subject = _('System notification') - elif type == 'comment' and not parent_id: - subject = _('Comment') - elif type == 'comment' and parent_id: - subject = _('Reply') + if type in ['notification', 'reply']: + subject = None if subtype == 'html': body_html = body body_text = body