[IMP] crm,project_issue: did related changes

bzr revid: rha@tinyerp.com-20110325041227-ljpbuaf8gu03ak89
This commit is contained in:
Rifakat Haradwala (Open ERP) 2011-03-25 09:42:27 +05:30
parent 029f420879
commit 24883b8c57
7 changed files with 19 additions and 16 deletions

View File

@ -199,13 +199,13 @@
<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"/>
<field name="subject" colspan="4" widget="char" size="512"/>
<field name="history" invisible="1"/>
</group>
<notebook colspan="4">
<page string="Details">
<group attrs="{'invisible': [('history', '!=', True)]}">
<field name="description" colspan="4" nolabel="1" height="250"/>
<field name="body" colspan="4" nolabel="1" height="250"/>
<button colspan="4" string="Reply"
name="%(email.action_email_compose_message_wizard)d"
context="{'mail':'reply', 'message_id':active_id}"

View File

@ -155,13 +155,13 @@
<field name="date"/>
<field name="email_to" size="512"/>
<field name="email_cc" size="512"/>
<field name="name" colspan="4" attrs="{'invisible': [('history', '=', True)]}"/>
<field name="subject" colspan="4" attrs="{'invisible': [('history', '=', True)]}"/>
<field name="display_text" colspan="4" attrs="{'invisible': [('history', '=', False)]}"/>
<field name="history" invisible="1"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
<field name="body" colspan="4" nolabel="1"/>
<group attrs="{'invisible': [('history', '!=', True)]}">
<button colspan="4"
string="Reply"

View File

@ -163,11 +163,11 @@ class email_message(osv.osv):
msg_txt = ''
if message.history:
msg_txt += (message.email_from or '/') + _(' wrote on ') + format_date_tz(message.date, tz) + ':\n\t'
if message.description:
msg_txt += self.truncate_data(cr, uid, message.description, context=context)
if message.body:
msg_txt += self.truncate_data(cr, uid, message.body, context=context)
else:
msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t'
msg_txt += message.name
msg_txt += message.subject
result[message.id] = msg_txt
return result
@ -228,6 +228,7 @@ class email_message(osv.osv):
'history': True,
'smtp_server_id': smtp_server_id,
'state': 'outgoing',
'auto_delete': auto_delete
}
email_msg_id = self.create(cr, uid, msg_vals, context)
if attach:

View File

@ -14,7 +14,7 @@
<field name="display_text"/>
</tree>
<form string="Mailgate History">
<field name="name" widget="char"/>
<field name="subject" widget="char"/>
<field name="date"/>
<field name="user_id"/>
<field name="message_id"/>

View File

@ -355,7 +355,7 @@ This is useful for CRM leads for example"),
"""
if context is None:
context = {}
smtp_pool = self.pool.get('email.smtp_server')
smtp_pool = self.pool.get('ir.mail_server')
email_message_pool = self.pool.get('email.message')
report_xml_pool = self.pool.get('ir.actions.report.xml')
template = self.get_email_template(cr, uid, template_id, record_id, context)
@ -363,7 +363,7 @@ This is useful for CRM leads for example"),
if not smtp_server_id and template.smtp_server_id:
smtp_server_id = template.smtp_server_id.id
else:
smtp_ids = smtp_pool.search(cr, uid, [('default','=',True)])
smtp_ids = smtp_pool.search(cr, uid, [])
smtp_server_id = smtp_ids and smtp_ids[0]
smtp_server = smtp_pool.browse(cr, uid, smtp_server_id, context=context)
# determine name of sender, either it is specified in email_id
@ -384,6 +384,7 @@ This is useful for CRM leads for example"),
'reply_to': self.get_template_value(cr, uid, template.reply_to, model, record_id, context),
'subject': self.get_template_value(cr, uid, template.subject, model, record_id, context),
'body': self.get_template_value(cr, uid, template.description, model, record_id, context),
'auto_delete': self.get_template_value(cr, uid, template.auto_delete, model, record_id, context),
#'body_html': self.get_template_value(cr, uid, template.body_html, model, record_id, context),
}
@ -432,9 +433,10 @@ This is useful for CRM leads for example"),
#Send emails
context.update({'notemplate':True})
email_id = email_message_pool.schedule_with_attach(cr, uid, values.get('email_from'), values.get('email_to'), values.get('name'), values.get('description'),
model=model, email_cc=values.get('email_cc'), email_bcc=values.get('email_bcc'), reply_to=values.get('reply_to'),
attach=attachment, message_id=values.get('message_id'), openobject_id=record_id, debug=True, subtype='plain', x_headers={}, priority='3', smtp_server_id=smtp_server.id, context=context)
email_id = email_message_pool.schedule_with_attach(cr, uid, values.get('email_from'), values.get('email_to'), values.get('name'),
values.get('description'), model=model, email_cc=values.get('email_cc'), email_bcc=values.get('email_bcc'),
reply_to=values.get('reply_to'), attach=attachment, message_id=values.get('message_id'), openobject_id=record_id,
debug=True, subtype='plain', x_headers={}, priority='3', smtp_server_id=smtp_server.id, auto_delete=values.get('auto_delete'), context=context)
email_message_pool.write(cr, uid, email_id, {'template_id': context.get('template_id',template.id)})
return email_id

View File

@ -44,7 +44,7 @@ class email_compose_message(osv.osv_memory):
result.update({
'template_id' : template.id,
'smtp_server_id' : template.smtp_server_id.id,
'body' : _get_template_value('description') or False,
'body' : _get_template_value('body') or False,
'subject' : _get_template_value('subject') or False,
'attachment_ids' : template_pool.read(cr, uid, template.id, ['attachment_ids'])['attachment_ids'] or [],
'res_id' : res_id or False,

View File

@ -113,13 +113,13 @@
<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"/>
<field name="subject" colspan="4" widget="char" size="512"/>
<field name="history" invisible="1"/>
</group>
<notebook colspan="4">
<page string="Details">
<group attrs="{'invisible': [('history', '!=', True)]}">
<field name="description" colspan="4" nolabel="1" height="250"/>
<field name="body" colspan="4" nolabel="1" height="250"/>
<button colspan="4" string="Reply"
name="%(email.action_email_compose_message_wizard)d"
context="{'mail':'reply', 'message_id':active_id}"