[MERGE] [IMP] mail: added message_last_update field. This field is a datetime field, updated everytime message_post in called. This allows to build filters, search or actions based on the last message date, for reporting for example.
Weekly groupbys have been added in project_issue and crm, for leads and opportunities. bzr revid: tde@openerp.com-20140305173945-3woymvjo9u6wdtef
This commit is contained in:
commit
9f3fbce2d9
|
@ -359,6 +359,7 @@
|
|||
<filter string="Campaign" domain="[]" context="{'group_by':'type_id'}"/>
|
||||
<filter string="Channel" domain="[]" context="{'group_by':'channel_id'}"/>
|
||||
<filter string="Creation" domain="[]" context="{'group_by':'create_date'}"/>
|
||||
<filter string="Last Post (weekly)" name="group_message_last_post" domain="[]" context="{'group_by':'message_last_post:week'}"/>
|
||||
</group>
|
||||
<group string="Display">
|
||||
<filter string="Show Countries" context="{'invisible_country': False}" help="Show Countries"/>
|
||||
|
@ -578,6 +579,7 @@
|
|||
<filter string="Channel" domain="[]" context="{'group_by':'channel_id'}"/>
|
||||
<filter string="Creation" domain="[]" context="{'group_by':'create_date'}"/>
|
||||
<filter string="Last Update Month" domain="[]" context="{'group_by':'write_date'}"/>
|
||||
<filter string="Last Post (weekly)" name="group_message_last_post" domain="[]" context="{'group_by':'message_last_post:week'}"/>
|
||||
</group>
|
||||
<group string="Display">
|
||||
<filter string="Show Sales Team" context="{'invisible_section': False}" domain="[]" help="Show Sales Team" groups="base.group_multi_salesteams"/>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -160,6 +160,7 @@
|
|||
<filter string="Priority" name="group_priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}"/>
|
||||
<filter string="Stage" name="group_stage_id" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
|
||||
<filter string="Creation Month" name="group_create_date" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}"/>
|
||||
<filter string="Last Post (weekly)" name="group_message_last_post" domain="[]" context="{'group_by':'message_last_post:week'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
|
Loading…
Reference in New Issue