← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~ysa-openerp/openobject-addons/email-framework-addons into lp:~openerp-dev/openobject-addons/emails-framework-addons

 

Yogesh(Open ERP) has proposed merging lp:~ysa-openerp/openobject-addons/email-framework-addons into lp:~openerp-dev/openobject-addons/emails-framework-addons.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~ysa-openerp/openobject-addons/email-framework-addons/+merge/49795

Fix problem in email_template and emails module.

-- 
https://code.launchpad.net/~ysa-openerp/openobject-addons/email-framework-addons/+merge/49795
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~ysa-openerp/openobject-addons/email-framework-addons into lp:~openerp-dev/openobject-addons/emails-framework-addons.
=== modified file 'email_template/email_template.py'
--- email_template/email_template.py	2011-02-15 09:58:33 +0000
+++ email_template/email_template.py	2011-02-15 12:21:38 +0000
@@ -86,14 +86,14 @@
                   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"

=== modified file 'email_template/wizard/email_template_preview.py'
--- email_template/wizard/email_template_preview.py	2011-02-15 05:48:05 +0000
+++ email_template/wizard/email_template_preview.py	2011-02-15 12:21:38 +0000
@@ -33,7 +33,7 @@
 
     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 @@
         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 @@
             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 @@
         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}
 

=== modified file 'email_template/wizard/email_template_send_wizard.py'
--- email_template/wizard/email_template_send_wizard.py	2011-02-15 10:34:42 +0000
+++ email_template/wizard/email_template_send_wizard.py	2011-02-15 12:21:38 +0000
@@ -46,7 +46,7 @@
             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

=== modified file 'emails/email_message.py'
--- emails/email_message.py	2011-02-15 09:58:33 +0000
+++ emails/email_message.py	2011-02-15 12:21:38 +0000
@@ -24,7 +24,7 @@
 from tools.translate import _
 import tools
 import netsvc
-
+import base64
 import time
 #import binascii
 #import email
@@ -67,7 +67,7 @@
 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 @@
         '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 = []
@@ -315,7 +315,7 @@
             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)])

=== modified file 'emails/email_view.xml'
--- emails/email_view.xml	2011-02-15 07:52:32 +0000
+++ emails/email_view.xml	2011-02-15 12:21:38 +0000
@@ -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"/>


Follow ups