[IMP] email.message.common:
*removed context email_model and email_res_id from related modules as there is no need *improvements for email.message.common *removed fields track_campaign_item and message_id and imp for email_template bzr revid: rha@tinyerp.com-20110413104145-htrse705w3aak2f3
This commit is contained in:
commit
a353b5e927
|
@ -108,7 +108,6 @@
|
|||
<field name="email_from" widget="email"/>
|
||||
<button string="Send Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'email_model':'crm.lead', 'email_res_id': active_id}"
|
||||
icon="terp-mail-message-new" type="action" colspan="1"/>
|
||||
<newline/>
|
||||
<field name="phone"/>
|
||||
|
@ -227,7 +226,6 @@
|
|||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'email_model':'crm.lead', 'email_res_id': active_id}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
<field name="email_from" string="Email" />
|
||||
<button string="Send Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'email_model': 'crm.lead', 'email_res_id': active_id}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</group>
|
||||
<field name="phone"/>
|
||||
|
@ -183,7 +182,6 @@
|
|||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'email_model': 'crm.lead', 'email_res_id': active_id}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
|
|
|
@ -40,7 +40,7 @@ class email_compose_message(osv.osv_memory):
|
|||
result.update({
|
||||
'subject' : data.name or False,
|
||||
'email_to' : data.email_from or False,
|
||||
'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False,
|
||||
'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or tools.config.get('email_from', False),
|
||||
'body' : '\n' + (tools.ustr(data.user_id.signature or '')),
|
||||
'email_cc' : tools.ustr(data.email_cc or ''),
|
||||
'model': model or False,
|
||||
|
|
|
@ -215,7 +215,6 @@
|
|||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'email_model':'crm.claim', 'email_res_id': active_id}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
|
|
@ -206,7 +206,6 @@
|
|||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'email_model':'crm.fundraising', 'email_res_id': active_id}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
|
|
|
@ -140,7 +140,6 @@
|
|||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'email_model':'crm.helpdesk', 'email_res_id': active_id}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
|
|
|
@ -65,19 +65,17 @@ class email_template(osv.osv):
|
|||
mod_name = self.pool.get('ir.model').browse(cr, uid, model_id, context).model
|
||||
return {'value':{'model':mod_name}}
|
||||
|
||||
def _lang_get(self, cr, uid, context={}):
|
||||
obj = self.pool.get('res.lang')
|
||||
ids = obj.search(cr, uid, [], context=context)
|
||||
res = obj.read(cr, uid, ids, ['code', 'name'], context)
|
||||
return [(r['code'], r['name']) for r in res] + [('','')]
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=250),
|
||||
'model_id':fields.many2one('ir.model', 'Resource'),
|
||||
'model': fields.related('model_id', 'model', string='Model', type="char", size=128, store=True, readonly=True),
|
||||
'track_campaign_item':fields.boolean('Resource Tracking',
|
||||
help="Enable this is you wish to include a special \
|
||||
tracking marker in outgoing emails so you can identify replies and link \
|
||||
them back to the corresponding resource record. \
|
||||
This is useful for CRM leads for example"),
|
||||
'lang':fields.char(
|
||||
'Language',
|
||||
size=250,
|
||||
help="The default language for the email."
|
||||
'lang': fields.selection(_lang_get, 'Language', size=5, help="The default language for the email."
|
||||
" Placeholders can be used here. "
|
||||
"eg. ${object.partner_id.lang}"),
|
||||
'subject':fields.char(
|
||||
|
@ -157,7 +155,6 @@ This is useful for CRM leads for example"),
|
|||
'email_to': fields.char('To', size=256, help="Email Recipients. Placeholders can be used here."),
|
||||
'email_cc': fields.char('Cc', size=256, help="Carbon Copy Email Recipients. Placeholders can be used here."),
|
||||
'email_bcc': fields.char('Bcc', size=256, help="Blind Carbon Copy Email Recipients. Placeholders can be used here."),
|
||||
'message_id': fields.char('Message Id', size=1024, select=1, help="Message Id on Email. Placeholders can be used here."),
|
||||
'reply_to':fields.char('Reply-To', size=250, help="Placeholders can be used here."),
|
||||
'body': fields.text('Description', translate=True, help="Placeholders can be used here."),
|
||||
'body_html': fields.text('HTML', help="Contains HTML version of email. Placeholders can be used here."),
|
||||
|
@ -183,7 +180,7 @@ This is useful for CRM leads for example"),
|
|||
'res_model': 'email.compose.message',
|
||||
'src_model': src_obj,
|
||||
'view_type': 'form',
|
||||
'context': "{'email_model':'%s', 'email_res_id': active_id,'template_id':'%d','src_rec_id':active_id,'src_rec_ids':active_ids}" % (src_obj, template.id),
|
||||
'context': "{'template_id':'%d','src_rec_id':active_id,'src_rec_ids':active_ids}" % (template.id),
|
||||
'view_mode':'form,tree',
|
||||
'view_id': res_id,
|
||||
'target': 'new',
|
||||
|
@ -388,14 +385,6 @@ This is useful for CRM leads for example"),
|
|||
#'body_html': self.get_template_value(cr, uid, template.body_html, model, record_id, context),
|
||||
}
|
||||
|
||||
if template.message_id:
|
||||
# use provided message_id with placeholders
|
||||
values.update({'message_id': self.get_template_value(cr, uid, template.message_id, model, record_id, context)})
|
||||
|
||||
elif template['track_campaign_item']:
|
||||
# get appropriate message-id
|
||||
values.update({'message_id': tools.generate_tracking_message_id(record_id)})
|
||||
|
||||
#Use signatures if allowed
|
||||
if template.user_signature:
|
||||
sign = self.pool.get('res.users').read(cr, uid, uid, ['signature'], context)['signature']
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<separator string="Options" colspan="2"/>
|
||||
<field name="lang" colspan="4" />
|
||||
<field name="user_signature" colspan="4" />
|
||||
<field name="track_campaign_item" colspan="4"/>
|
||||
<field name="auto_delete"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Email Content"/>
|
||||
|
@ -72,11 +72,6 @@
|
|||
<field name="ref_ir_value"/>
|
||||
<button name="unlink_action" string="Delete Action" type="object" icon="gtk-delete" colspan="2" attrs="{'invisible':[('ref_ir_act_window','=',False), ('ref_ir_value','=',False)]}"/>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Advanced Options" colspan="2"/>
|
||||
<field name="message_id"/>
|
||||
<field name="auto_delete"/>
|
||||
</group>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Attachments" colspan="2"/>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
from osv import osv
|
||||
from osv import fields
|
||||
import tools
|
||||
from tools.translate import _
|
||||
|
||||
class email_compose_message(osv.osv_memory):
|
||||
_name = 'email.compose.message'
|
||||
|
@ -40,7 +41,7 @@ class email_compose_message(osv.osv_memory):
|
|||
if len(context.get('src_rec_ids',[])) > 1: # Multiple Mail: Gets original template values for multiple email change
|
||||
return getattr(template, field)
|
||||
else: # Simple Mail: Gets computed template values
|
||||
return template_pool.get_template_value(cr, uid, getattr(template, field), template.model, context.get('email_res_id'), context)
|
||||
return template_pool.get_template_value(cr, uid, getattr(template, field), template.model, context.get('active_id'), context)
|
||||
result.update({
|
||||
'template_id' : template.id,
|
||||
'smtp_server_id' : template.smtp_server_id.id,
|
||||
|
@ -138,6 +139,12 @@ class email_compose_message(osv.osv_memory):
|
|||
vals.update(self.get_template_data(cr, uid, resource_id, template_id, context))
|
||||
else:
|
||||
vals.update({'attachment_ids' : []})
|
||||
email_temp_pool = self.pool.get('email.template')
|
||||
if context.get('active_model') and context.get('active_id') and email_temp_pool.browse(cr, uid, template_id, context=context).user_signature:
|
||||
model_pool = self.pool.get(context['active_model'])
|
||||
user = model_pool.browse(cr, uid, context['active_id'], context=context).user_id
|
||||
signature = user and user.signature
|
||||
vals['body'] = _('%s\n%s') %(vals['body'], signature or '')
|
||||
return {'value': vals}
|
||||
|
||||
email_compose_message()
|
||||
|
|
|
@ -90,10 +90,6 @@ class email_template_preview(osv.osv_memory):
|
|||
vals['email_cc'] = self.get_template_value(cr, uid, template.email_cc, model, res_id, context)
|
||||
vals['email_bcc'] = self.get_template_value(cr, uid, template.email_bcc, model, res_id, context)
|
||||
vals['reply_to'] = self.get_template_value(cr, uid, template.reply_to, model, res_id, context)
|
||||
if template.message_id:
|
||||
vals['message_id'] = self.get_template_value(cr, uid, message_id, model, res_id, context)
|
||||
elif template.track_campaign_item:
|
||||
vals['message_id'] = tools.generate_tracking_message_id(res_id)
|
||||
vals['subject'] = self.get_template_value(cr, uid, template.subject, model, res_id, context)
|
||||
description = self.get_template_value(cr, uid, template.body, model, res_id, context) or ''
|
||||
if template.user_signature:
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
<field name="email_cc" readonly="1"/>
|
||||
<field name="email_bcc" readonly="1"/>
|
||||
<field name="reply_to" readonly="1"/>
|
||||
<field name="message_id" readonly="1" attrs="{'invisible':[('message_id','=',False)]}" groups="base.group_extended"/>
|
||||
<field name="subject" colspan="8" readonly="1"/>
|
||||
</group>
|
||||
<group col="4" colspan="4">
|
||||
|
|
|
@ -58,12 +58,6 @@ class email_template_send_wizard(osv.osv_memory):
|
|||
if 'smtp_server_id' in fields:
|
||||
result['smtp_server_id'] = template.smtp_server_id.id
|
||||
|
||||
if 'message_id' in fields:
|
||||
result['message_id'] = template.message_id
|
||||
|
||||
if 'track_campaign_item' in fields:
|
||||
result['track_campaign_item'] = template.track_campaign_item
|
||||
|
||||
if 'attachment_ids' in fields:
|
||||
result['attachment_ids'] = template_pool.read(cr, uid, template.id, ['attachment_ids'])['attachment_ids']
|
||||
|
||||
|
|
|
@ -431,7 +431,6 @@
|
|||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'email_model':'event.registration', 'email_res_id': active_id}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
|
|
@ -185,7 +185,6 @@
|
|||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'email_model': 'hr.applicant', 'email_res_id': active_id}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Notes">
|
||||
|
|
|
@ -72,7 +72,7 @@ def format_date_tz(date, tz=None):
|
|||
class email_message_common(osv.osv_memory):
|
||||
_name = 'email.message.common'
|
||||
_columns = {
|
||||
'subject':fields.text('Subject', translate=True),
|
||||
'subject':fields.text('Subject'),
|
||||
'model': fields.char('Object Name', size=128, select=1),
|
||||
'res_id': fields.integer('Resource ID', select=1),
|
||||
'date': fields.datetime('Date'),
|
||||
|
@ -87,7 +87,7 @@ class email_message_common(osv.osv_memory):
|
|||
'sub_type': fields.char('Sub Type', size=32),
|
||||
'headers': fields.text('x_headers'),
|
||||
'priority':fields.integer('Priority'),
|
||||
'body': fields.text('Description', translate=True),
|
||||
'body': fields.text('Description'),
|
||||
'body_html': fields.text('HTML', help="Contains HTML version of email"),
|
||||
'smtp_server_id':fields.many2one('ir.mail_server', 'SMTP Server'),
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ class email_message(osv.osv):
|
|||
msg_txt['message-id'] = message_id
|
||||
_logger.info('Parsing Message without message-id, generating a random one: %s', message_id)
|
||||
|
||||
|
||||
|
||||
fields = msg_txt.keys()
|
||||
msg['id'] = message_id
|
||||
msg['message-id'] = message_id
|
||||
|
@ -422,7 +422,7 @@ class email_message(osv.osv):
|
|||
subtype=message.sub_type,
|
||||
x_headers=message.headers and eval(message.headers) or {},
|
||||
priority=message.priority)
|
||||
res = smtp_server_obj.send_email(cr, uid,
|
||||
res = smtp_server_obj.send_email(cr, uid,
|
||||
msg,
|
||||
mail_server_id = message.smtp_server_id.id or None,
|
||||
smtp_server=smtp_server and smtp_server.smtp_host or None,
|
||||
|
|
|
@ -100,6 +100,7 @@ class email_compose_message(osv.osv_memory):
|
|||
|
||||
_columns = {
|
||||
'attachment_ids': fields.many2many('ir.attachment','email_message_send_attachment_rel', 'wizard_id', 'attachment_id', 'Attachments'),
|
||||
'auto_delete': fields.boolean('Auto Delete', help="Permanently delete emails after sending"),
|
||||
}
|
||||
|
||||
def get_value(self, cr, uid, model, res_id, context=None):
|
||||
|
@ -130,7 +131,7 @@ class email_compose_message(osv.osv_memory):
|
|||
'body' : description,
|
||||
'subject' : subject,
|
||||
'message_id' : message_data and message_data.message_id or False,
|
||||
'attachment_ids' : message_data and message_pool.read(cr, uid, message_id, ['attachment_ids'])['attachment_ids'] or [],
|
||||
'attachment_ids' : [],
|
||||
'res_id' : message_data and message_data.res_id or False,
|
||||
'email_from' : message_data and message_data.email_to or False,
|
||||
'email_to' : message_data and message_data.email_from or False,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<form string="Reply Email">
|
||||
<group col="6" colspan="4">
|
||||
<field name="model" invisible="1"/>
|
||||
<field name="smtp_server_id" widget="selection" colspan="4"/>
|
||||
<field name="smtp_server_id" widget="selection" colspan="4" invisible="1"/>
|
||||
<field name="email_from" colspan="4" required="1"/>
|
||||
<field name="email_to" colspan="4" required="1"/>
|
||||
<field name="email_cc" colspan="4"/>
|
||||
|
|
|
@ -142,7 +142,6 @@
|
|||
icon="terp-document-new" type="action" />
|
||||
<button string="Send New Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
context="{'email_model':'project.issue', 'email_res_id': active_id}"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
<button name="do_reopen" states="done,cancelled" string="Reactivate" type="object" icon="gtk-convert"/>
|
||||
<button name="do_pending" states="open" string="Pending" type="object" icon="gtk-media-pause"/>
|
||||
<button groups="base.group_extended" name="%(project.action_project_task_delegate)d" states="pending,open" string="Delegate" type="action" icon="gtk-sort-descending"/>
|
||||
<button name="%(mail.action_email_compose_message_wizard)d" context="{'email_model':'project.task', 'email_res_id': active_id}" states="pending,open" string="Done" type="action" icon="gtk-jump-to"/>
|
||||
<button name="%(mail.action_email_compose_message_wizard)d" states="pending,open" string="Done" type="action" icon="gtk-jump-to"/>
|
||||
</group>
|
||||
</page>
|
||||
<page groups="base.group_extended" string="Extra Info" attrs="{'readonly':[('state','=','done')]}">
|
||||
|
|
|
@ -398,7 +398,7 @@
|
|||
<field name="user_id"/>
|
||||
<button name="%(mail.action_email_compose_message_wizard)d"
|
||||
string="Send Email" type="action" icon="terp-mail-message-new"
|
||||
context="{'email_model': 'project.scrum.meeting', 'email_res_id': active_id}"/>
|
||||
/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Scrum Meeting">
|
||||
|
|
Loading…
Reference in New Issue