[IMP] mail.message: can now have void subjects. Void subjects are not displayed in chatter/wall; this allows to have a more flexible way to display blog post, while avoiding to display unnecessary data for notifications or quick replies. This imply that a way to manually add a subject when posting a comment is required; this will be done in openchatter part3.
bzr revid: tde@openerp.com-20120629152758-9t23sdvtpdd49yyd
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user