diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 99b2be14923..6e8cf326649 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -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" diff --git a/addons/email_template/wizard/email_template_preview.py b/addons/email_template/wizard/email_template_preview.py index e8cb7970973..09abd9fe8ff 100644 --- a/addons/email_template/wizard/email_template_preview.py +++ b/addons/email_template/wizard/email_template_preview.py @@ -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} diff --git a/addons/email_template/wizard/email_template_send_wizard.py b/addons/email_template/wizard/email_template_send_wizard.py index 092b81da669..bf09af8d3b6 100644 --- a/addons/email_template/wizard/email_template_send_wizard.py +++ b/addons/email_template/wizard/email_template_send_wizard.py @@ -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 diff --git a/addons/emails/email_message.py b/addons/emails/email_message.py index 77557738262..ca4010a02b1 100644 --- a/addons/emails/email_message.py +++ b/addons/emails/email_message.py @@ -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)]) diff --git a/addons/emails/email_view.xml b/addons/emails/email_view.xml index 656f530e1fa..307e310203b 100644 --- a/addons/emails/email_view.xml +++ b/addons/emails/email_view.xml @@ -12,7 +12,7 @@
- + @@ -76,6 +76,8 @@ + +