[IMP]: mail_gateway: Added a function field in mailgate message to provide a better visual display for case history like launchpad bugs

bzr revid: rpa@tinyerp.com-20100716104121-a2mnuneefl4knjn9
This commit is contained in:
rpa (Open ERP) 2010-07-16 16:11:21 +05:30
parent 9230c1f5a4
commit c5021c95f1
22 changed files with 222 additions and 325 deletions

View File

@ -151,8 +151,7 @@ and users"),
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True),('model','=',_name)], readonly=True),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)], readonly=True),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)], readonly=True),
'partner_assigned_id': fields.many2one('res.partner', 'Assigned Partner', help="Partner this case has been forwarded/assigned to.", select=True),
'date_assign': fields.date('Assignation Date', help="Last date this case was forwarded/assigned to a partner"),
}

View File

@ -158,8 +158,15 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="CC" widget="char" size="512"/>
</group>
<!-- TODO-->
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
@ -177,17 +184,11 @@
</page>
</notebook>
<button colspan="4"
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="2" string="Send New Email"
name="%(crm.action_crm_send_mail)d"

View File

@ -68,8 +68,7 @@ class crm_meeting(osv.osv, crm_case):
'event_id', 'attendee_id', 'Attendees', states={'done': [('readonly', True)]}),
'date_closed': fields.datetime('Closed', readonly=True),
'date_deadline': fields.datetime('Deadline', states={'done': [('readonly', True)]}),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True),('model','=',_name)]),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'state': fields.selection([('open', 'Confirmed'),
('draft', 'Unconfirmed'),
('cancel', 'Cancelled'),

View File

@ -120,7 +120,15 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="Cc" widget="char" size="512"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree" height="280">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
@ -138,17 +146,11 @@
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="2" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
@ -176,19 +178,6 @@
<separator colspan="4" string="References"/>
<field name="ref"/>
<field name="ref2"/>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
<page string="Assignation" groups="base.group_extended">
<group name="partner_assign_group" col="5" colspan="4">

View File

@ -82,8 +82,7 @@ class crm_phonecall(osv.osv, crm_case):
'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'),
'opportunity_id': fields.many2one ('crm.lead', 'Opportunity'),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True),('model','=',_name)]),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
}
_defaults = {

View File

@ -229,26 +229,6 @@
<field name="view_id" ref="crm_case_section_view_tree"/>
</record>
<!-- Cases Tree View -->
<record id="crm_case_log_tree-view" model="ir.ui.view">
<field name="name">crm.case.log.tree</field>
<field name="model">crm.case.log</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Case logs">
<field name="date"/>
<field name="name"/>
<field name="user_id"/>
<field name="section_id"/>
<!--
<field name="som"/>
<field name="canal_id"/>
-->
</tree>
</field>
</record>
<!-- Segmentation line Tree View -->
<record id="crm_segmentation_line_tree-view" model="ir.ui.view">
@ -564,54 +544,43 @@
<field name="active" select="2"/>
<separator colspan="4" string="References"/>
<field colspan="4" name="ref"/>
<field colspan="4" name="log_ids" nolabel="1">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC" widget="char" size="512"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.case.custom', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.case.custom', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.case.custom', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
</field>
<button colspan="2" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.case.custom'}"

View File

@ -126,11 +126,12 @@ class crm_lead_forward_to_partner(osv.osv_memory):
elif history_type == 'whole':
log_ids = model_pool.browse(cr, uid, res_id, context=context).message_ids
log_ids = [x.id for x in log_ids]
log_ids = map(lambda x: x.id, filter(lambda x: x.history, log_ids))
msg_val = case_info + '\n\n' + self.get_whole_history(cr, uid, log_ids, context=context)
elif history_type == 'latest':
log_ids = model_pool.browse(cr, uid, res_id, context=context).message_ids
log_ids = filter(lambda x: x.history and x.id, log_ids)
if not log_ids:
msg_val = case_info
else:
@ -227,7 +228,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
elif lead.type == 'opportunity':
pa = lead.partner_address_id
body = [
"Partner: %s" % (lead.partner_id.name_get()[0][1]),
"Partner: %s" % (lead.partner_id and lead.partner_id.name_get()[0][1]),
"Contact: %s" % (pa.name or ''),
"Title: %s" % (pa.title or ''),
"Function: %s" % (pa.function and pa.function.name_get()[0][1] or ''),

View File

@ -105,7 +105,7 @@ class crm_send_new_email(osv.osv_memory):
ref_id = hist.ref_id
case = case_pool.browse(cr, uid, res_id, context=context)
emails = [obj.email_to]
email_cc = re.findall(r'([^ ,<@]+@[^> ,]+)', obj.email_cc)
email_cc = re.findall(r'([^ ,<@]+@[^> ,]+)', obj.email_cc or '')
emails = filter(None, emails)
body = obj.body

View File

@ -22,6 +22,7 @@
from osv import fields, osv
from crm import crm
import time
class crm_claim(osv.osv, crm.crm_case):
"""
Crm claim
@ -86,8 +87,7 @@ class crm_claim(osv.osv, crm.crm_case):
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True),('model','=',_name)]),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
}
_defaults = {

View File

@ -168,12 +168,22 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree" height="280">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.claim', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
@ -184,17 +194,11 @@
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead'}"
icon="terp-mail-replied" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.claim', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
@ -209,19 +213,6 @@
<separator colspan="4" string="Dates"/>
<field name="create_date"/>
<field name="date_closed"/>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</group>

View File

@ -85,8 +85,7 @@ class crm_fundraising(osv.osv, crm.crm_case):
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True),('model','=',_name)]),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
}
_defaults = {

View File

@ -158,12 +158,22 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.fundraising', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
@ -174,17 +184,11 @@
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.fundraising'}"
icon="gtk-undo" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.fundraising', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
@ -212,19 +216,6 @@
<field colspan="4" name="ref"/>
<field colspan="4" name="ref2"/>
</group>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</form>

View File

@ -75,8 +75,7 @@ class crm_helpdesk(osv.osv, crm.crm_case):
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True),('model','=',_name)]),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
}
_defaults = {

View File

@ -96,12 +96,22 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
@ -112,17 +122,11 @@
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.helpdesk'}"
icon="gtk-undo" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
@ -150,19 +154,6 @@
<field colspan="4" name="ref"/>
<field colspan="4" name="ref2"/>
</group>
<field colspan="4" name="log_ids" nolabel="1">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</form>

View File

@ -311,7 +311,7 @@ class event_registration(osv.osv):
'date_closed': fields.datetime('Closed', readonly=True),
'ref': fields.reference('Reference', selection=crm._links_get, size=128),
'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True),('model','=',_name)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]),
'date_deadline': fields.related('event_id','date_end', type='datetime', string="End Date", readonly=True, store=True),
'date': fields.related('event_id', 'date_begin', type='datetime', string="Start Date", readonly=True, store=True),

View File

@ -369,15 +369,23 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="CC" widget="char" size="512"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'event.registration', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
@ -387,18 +395,12 @@
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'event.registration', 'include_original' : True}"
icon="gtk-undo" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'event.registration', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'event.registration'}"

View File

@ -65,8 +65,7 @@ class hr_applicant(osv.osv, crm.crm_case):
_inherit = ['mailgate.thread']
_columns = {
'name': fields.char('Name', size=128, required=True),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True),('model','=',_name)]),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the case without removing it."),
'description': fields.text('Description'),
'section_id': fields.many2one('crm.case.section', 'Sales Team', \

View File

@ -140,56 +140,47 @@
<page string="History" groups="base.group_extended">
<field name="id"/>
<field name="active"/>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'hr.applicant'}"
context="{'mail':'reply', 'model': 'hr.applicant', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
</tree>
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'hr.applicant'}"
icon="gtk-go-forward" type="action" />
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'hr.applicant', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'hr.applicant'}"
icon="gtk-go-forward" type="action" />
</page>
</notebook>
</form>

View File

@ -41,8 +41,7 @@ class mailgate_thread(osv.osv):
_description = 'Mailgateway Thread'
_columns = {
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True)], readonly=True),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False)], readonly=True),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', readonly=True),
}
def message_new(self, cr, uid, msg, context):
@ -145,9 +144,25 @@ class mailgate_message(osv.osv):
'''
Mailgateway Message
'''
def _get_display_text(self, cr, uid, ids, name, arg, context=None):
result = {}
for message in self.browse(cr, uid, ids, context=context):
msg_txt = ''
if message.history:
msg_txt += (message.email_from or '/') + ' wrote on ' + message.date + ':\n\t'
msg_txt += '\n\t'.join(message.description.split('\n')[:3]) + '...'
else:
msg_txt = (message.user_id.name or '/') + ' on ' + message.date + ':\n\t'
if message.name == 'Opportunity':
msg_txt += "Converted to Opportunity"
else:
msg_txt += "Changed Status to: " + message.name
result[message.id] = msg_txt
return result
_name = 'mailgate.message'
_description = 'Mailgateway Message'
_order = 'id desc'
_order = 'date desc'
_columns = {
'name':fields.text('Subject', readonly=True),
'model': fields.char('Object Name', size=128, select=1, readonly=True),
@ -166,6 +181,7 @@ class mailgate_message(osv.osv):
'description': fields.text('Description', readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner', required=False),
'attachment_ids': fields.many2many('ir.attachment', 'message_attachment_rel', 'message_id', 'attachment_id', 'Attachments', readonly=True),
'display_text': fields.function(_get_display_text, method=True, type='text', size="512", string='Display Text'),
}
def init(self, cr):

View File

@ -79,41 +79,10 @@
<group col="6" colspan="4">
<field name="thread" select="1" colspan="3"/>
</group>
<separator string="Logs" colspan="4"/>
<field name="log_ids" nolabel="1" colspan="4" domain="[('history', '=', True)]">
<tree string="Mailgateway Logs">
<field name="name" select="1" />
<field name="date" />
</tree>
<form string="Mailgate Logs">
<field name="name" widget="char" size="512"/>
<field name="date" />
<field name="user_id" />
<field name="message_id" />
<notebook colspan="4">
<page string="Email Details">
<group col="4" colspan="4">
<separator string="Email Details" colspan="4"/>
<field name="email_from" />
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="email_bcc" widget="char" size="512"/>
</group>
<separator string="Description" colspan="4"/>
<field name="description" nolabel="1" colspan="4" />
</page>
<page string="Attachments">
<separator string="Attachments" colspan="4"/>
<field name="attachment_ids" nolabel="1" colspan="4" />
</page>
</notebook>
</form>
</field>
<separator string="History" colspan="4"/>
<field name="message_ids" nolabel="1" colspan="4" domain="[('history', '=', True)]">
<field name="message_ids" nolabel="1" colspan="4" mode="tree,form">
<tree string="Mailgateway History">
<field name="name" select="1" />
<field name="date" />
<field name="display_text" />
</tree>
<form string="Mailgate History">
<field name="name" widget="char" size="512"/>

View File

@ -188,8 +188,7 @@ class project_issue(osv.osv, crm.crm_case):
method=True, multi='working_days_open', type="float", store=True),
'working_hours_close': fields.function(_compute_day, string='Working Hours to Close the Issue', \
method=True, multi='working_days_close', type="float", store=True),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True),('model','=',_name)]),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
}

View File

@ -75,12 +75,22 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'project.issue', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
@ -90,17 +100,13 @@
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4" string="Reply to Last Email" name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'project.issue', 'include_original' : True}"
icon="gtk-undo" type="action" />
<button colspan="4"
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'project.issue', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
</field>
<separator colspan="4"/>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
@ -127,19 +133,6 @@
<field name="id"/>
<field name="active"/>
</group>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</form>