[IMP] Project Issue: Replaces the old message_ids based detection of new messages by an override of mail_thread message_post. The date of last action will be updated to the current date on each message_post call.

bzr revid: cbi@openerp.com-20130312122428-9s21kgtac8u3lyaf
This commit is contained in:
Chris Biersbach 2013-03-12 13:24:28 +01:00
parent f053d2fb5b
commit 12e1e6ad79
1 changed files with 9 additions and 1 deletions

View File

@ -393,7 +393,7 @@ class project_issue(base_stage, osv.osv):
def write(self, cr, uid, ids, vals, context=None):
#Update last action date every time the user change the stage, the state or send a new email
logged_fields = ['stage_id', 'state', 'message_ids']
logged_fields = ['stage_id', 'state']
if any([field in vals for field in logged_fields]):
vals['date_action_last'] = time.strftime('%Y-%m-%d %H:%M:%S')
@ -545,6 +545,14 @@ class project_issue(base_stage, osv.osv):
return super(project_issue, self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context)
def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification', subtype=None, parent_id=False, attachments=None, context=None, content_subtype='html', **kwargs):
""" Overrides mail_thread message_post so that we can set the date of last action field when
a new message is posted on the issue.
"""
if thread_id:
self.write(cr, uid, thread_id, {'date_action_last': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
return super(project_issue, self).message_post(cr, uid, thread_id, body=body, subject=subject, type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, content_subtype=content_subtype, **kwargs)
class project(osv.osv):
_inherit = "project.project"