[FIX] crm: Replace Details by Notes
authorStephane Wirtel <stephane@openerp.com>
Fri, 9 Apr 2010 14:35:44 +0000 (16:35 +0200)
committerStephane Wirtel <stephane@openerp.com>
Fri, 9 Apr 2010 14:35:44 +0000 (16:35 +0200)
[FIX] crm: Add the include_original flag in the context, to allows to include the original message for the "send new email" or "reply to email" functions

bzr revid: stephane@openerp.com-20100409143544-smmsfmtfqvrha3cx

addons/crm/crm_fund_view.xml
addons/crm/crm_helpdesk_view.xml
addons/crm/crm_lead_view.xml
addons/crm/wizard/crm_send_email.py

index 5b83b38..a2a104a 100644 (file)
                         <field name="date"/>
                         <field name="duration"/>
                     </group>
-                    <separator colspan="4" string="Details"/>
+                    <separator colspan="4" string="Notes"/>
                         <field name="description" nolabel="1" colspan="4"/>
                     <separator colspan="4"/>
                     <group col="8" colspan="4">
index bf430ea..dc11b07 100644 (file)
@@ -58,7 +58,7 @@
                                 icon="gtk-go-forward" />
                         </group>
 
-                        <separator colspan="4" string="Details"/>
+                        <separator colspan="4" string="Notes"/>
                         <field name="description" colspan="4"
                                 nolabel="1" widget="text_tag" readonly="1" />
                         <separator colspan="4"/>
index a54cf7c..829372f 100644 (file)
                             <newline/>
                             <field name="description" colspan="4" nolabel="1"/>
                             <button colspan="4"
-                                string="Reply to Email"
+                                string="Reply to Last Email"
                                 name="%(action_crm_send_mail)d"
-                                context="{'mail':'reply', 'model': 'crm.lead'}"
+                                context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
                                 icon="gtk-undo" type="action" />
                         </form>
                         <tree string="Communication history">
index 5fe6b18..99f3244 100644 (file)
@@ -182,6 +182,8 @@ class crm_send_new_email(osv.osv_memory):
         """
         hist_obj = self.pool.get('crm.case.history')
         res_ids = context and context.get('active_ids', []) or []
+
+        include_original = context and context.get('include_original', False) or False
         res = {}
         for hist in hist_obj.browse(cr, uid, res_ids):
             model = hist.log_id.model_id.model
@@ -193,7 +195,8 @@ class crm_send_new_email(osv.osv_memory):
                 res.update({'email_from': (case.section_id and case.section_id.reply_to) or \
                             (case.user_id and case.user_id.address_id and \
                             case.user_id.address_id.email) or hist.email_to or tools.config.get('email_from',False)})
-            if 'text' in fields:
+
+            if include_original == True and 'text' in fields:
                 header = '-------- Original Message --------'
                 sender = 'From: %s' %(hist.email_from or '')
                 to = 'To: %s' % (hist.email_to or '')