diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index e76a7a9124d..d054e956ed6 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -359,6 +359,7 @@ + @@ -578,6 +579,7 @@ + diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index adf02a4e918..c72ef8a77cb 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -306,6 +306,8 @@ class mail_thread(osv.AbstractModel): auto_join=True, string='Messages', help="Messages and communication history"), + 'message_last_post': fields.datetime('Last Message Date', + help='Date of the last message posted on the record.'), 'message_unread': fields.function(_get_message_data, fnct_search=_search_message_unread, multi="_get_message_data", type='boolean', string='Unread Messages', @@ -1552,8 +1554,13 @@ class mail_thread(osv.AbstractModel): for x in ('from', 'to', 'cc'): values.pop(x, None) - # Create and auto subscribe the author + # Post the message msg_id = mail_message.create(cr, uid, values, context=context) + + # Post-process: subscribe author, update message_last_post + if model and model != 'mail.thread' and thread_id and subtype_id: + # done with SUPERUSER_ID, because on some models users can post only with read access, not necessarily write access + self.write(cr, SUPERUSER_ID, [thread_id], {'message_last_post': fields.datetime.now()}, context=context) message = mail_message.browse(cr, uid, msg_id, context=context) if message.author_id and thread_id and type != 'notification' and not context.get('mail_create_nosubscribe'): self.message_subscribe(cr, uid, [thread_id], [message.author_id.id], context=context) diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 68c6712f530..3af9ee608d6 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -160,6 +160,7 @@ +