bzr revid: hmo@tinyerp.com-20110215131547-hqt0ayfys5g0zixh
This commit is contained in:
Harry (OpenERP)
2011-02-15 18:45:47 +05:30
5 changed files with 35 additions and 25 deletions
+8 -8
View File
@@ -86,14 +86,14 @@ This is useful for CRM leads for example"),
help="The subject of email."
" Placeholders can be used here.",
translate=True),
'description':fields.text(
'Standard Body (Text)',
help="The text version of the mail",
translate=True),
'body_html':fields.text(
'Body (Text-Web Client Only)',
help="The text version of the mail",
translate=True),
# 'description':fields.text(
# 'Standard Body (Text)',
# help="The text version of the mail",
# translate=True),
# 'body_html':fields.text(
# 'Body (Text-Web Client Only)',
# help="The text version of the mail",
# translate=True),
'user_signature':fields.boolean(
'Signature',
help="the signature from the User details"
@@ -33,7 +33,7 @@ class email_template_preview(osv.osv_memory):
def _get_records(self, cr, uid, context=None):
"""
Return Records of particular Email Template's Model
Return Records of particular Email Template's Model
"""
if context is None:
context = {}
@@ -50,9 +50,9 @@ class email_template_preview(osv.osv_memory):
default_id = context.get('default_res_id')
if default_id and default_id not in record_ids:
record_ids.insert(0, default_id)
return model.name_get(cr, uid, record_ids, context)
def default_get(self, cr, uid, fields, context=None):
if context is None:
@@ -80,7 +80,7 @@ class email_template_preview(osv.osv_memory):
return {}
vals = {}
if context == {}:
context = self.context
context = self.context
template_pool = self.pool.get('email.template')
template_id = context.get('template_id', False)
@@ -93,10 +93,9 @@ class email_template_preview(osv.osv_memory):
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.misc.generate_tracking_message_id(rel_model_ref)
vals['message_id'] = tools.misc.generate_tracking_message_id(res_id)
vals['subject'] = self.get_template_value(cr, uid, template.subject, model, res_id, context)
vals['description'] = self.get_template_value(cr, uid, template.description, model, res_id, context)
vals['body_html'] = self.get_template_value(cr, uid, template.body_html, model, res_id, context)
vals['report_name'] = self.get_template_value(cr, uid, template.report_name, model, res_id, context)
return {'value':vals}
@@ -46,7 +46,7 @@ class email_template_send_wizard(osv.osv_memory):
if len(context['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 self.get_template_value(cr, uid, getattr(template, field), template.model, context)
return self.get_template_value(cr, uid, getattr(template, field), template.model, context.get('active_id'), context)
if 'user_signature' in fields:
result['user_signature'] = template.user_signature
+5 -5
View File
@@ -24,7 +24,7 @@ from osv import fields
from tools.translate import _
import tools
import netsvc
import base64
import time
#import binascii
#import email
@@ -67,7 +67,7 @@ def format_date_tz(date, tz=None):
class email_message_template(osv.osv_memory):
_name = 'email.message.template'
_columns = {
'name':fields.text('Subject'),
'name':fields.text('Subject', translate=True),
'model': fields.char('Object Name', size=128, select=1),
'res_id': fields.integer('Resource ID', select=1),
'date': fields.datetime('Date'),
@@ -82,7 +82,7 @@ class email_message_template(osv.osv_memory):
'sub_type': fields.char('Sub Type', size=32),
'headers': fields.char('x_headers',size=256),
'priority':fields.integer('Priority'),
'description': fields.text('Description'),
'description': fields.text('Description', translate=True),
'smtp_server_id':fields.many2one('email.smtp_server', 'SMTP Server'),
}
_sql_constraints = []
@@ -284,7 +284,7 @@ class email_message(osv.osv):
for attachment in attach:
attachment_data = {
'name': (subject or '') + _(' (Email Attachment)'),
'datas': attachment[1],
'datas': base64.b64encode(attachment[1]),
'datas_fname': attachment[0],
'description': subject or _('No Description'),
'res_model':'email.message',
@@ -315,7 +315,7 @@ class email_message(osv.osv):
try:
attachments = []
for attach in message.attachment_ids:
attachments.append((attach.datas_fname ,attach.datas))
attachments.append((attach.datas_fname ,base64.b64decode(attach.datas)))
smtp_server = message.smtp_server_id
if not smtp_server:
smtp_ids = smtp_server_obj.search(cr, uid, [('default','=',True)])
+16 -5
View File
@@ -12,7 +12,7 @@
<field name="arch" type="xml">
<form string="Email message">
<group colspan="4" col="6">
<field name="name" widget="char"/>
<field name="name" widget="char" size="512"/>
<field name="date"/>
<field name="user_id" string="Owner"/>
<field name="partner_id" readonly="1" />
@@ -76,6 +76,8 @@
<field name="user_id" string="Owner"/>
<field name="message_id" string="Message" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="folder"/>
<field name="state"/>
<button name="open_document" string="Open Document" type="object" icon="gtk-jump-to"/>
<button name="open_attachment" string="Open Attachments" type="object" icon="gtk-jump-to"/>
</tree>
@@ -88,14 +90,23 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Email Search">
<filter icon="terp-document-new" string="Draft" domain="[('folder','=','drafts')]"/>
<filter icon="terp-personal" string="Inbox" domain="[('folder','=','inbox')]"/>
<filter icon="terp-check" string="Outbox" domain="[('folder','=','outbox')]"/>
<filter icon="terp-partner" string="Sent Items" domain="[('folder','=','sent')]"/>
<filter icon="terp-mail_delete" string="Trash" domain="[('folder','=','trash')]"/>
<separator orientation="vertical"/>
<filter icon="terp-call-start" string="Waiting" domain="[('state','=','waiting')]"/>
<filter icon="terp-gtk-stop" string="Exception" domain="[('state','=','exception')]"/>
<field name="name"/>
<field name="date"/>
<field name="user_id" string="Owner"/>
<field name="partner_id" string="Partner Name"/>
<newline/>
<group expand="0" string="Group By..." groups="base.group_extended">
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Owner" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
<filter string="Ower" name="Ower" icon="terp-personal" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Thread" icon="terp-mail-" domain="[]" context="{'group_by':'message_id'}"/>
<separator orientation="vertical"/>
@@ -152,14 +163,14 @@
<field name="smtpport"/>
<field name="smtpssl"/>
<field name="smtptls"/>
</group>
</group>
<separator string="User Information" colspan="4"/>
<group col="6" colspan="4">
<field name="email_id"/>
<field name="smtpuname"/>
<field name="smtppass" password="True"/>
</group>
<separator string="" colspan="4"/>
<label string="" colspan="2"/>