[ADD] Thread widget: added a 'reply by email' link. Open the mail.compose.message...
authorThibault Delavallée <tde@openerp.com>
Fri, 20 Apr 2012 15:58:27 +0000 (17:58 +0200)
committerThibault Delavallée <tde@openerp.com>
Fri, 20 Apr 2012 15:58:27 +0000 (17:58 +0200)
bzr revid: tde@openerp.com-20120420155827-8of3e0i70getenpl

addons/mail/static/src/js/mail.js
addons/mail/static/src/xml/mail.xml
addons/mail/wizard/mail_compose_message.py
addons/mail/wizard/mail_compose_message_view.xml

index 835b1bc..5eed795 100644 (file)
@@ -225,6 +225,22 @@ openerp.mail = function(session) {
             this.$element.find('div.oe_mail_thread_display').delegate('img.oe_mail_msg_menu_icon', 'click', function (event) {
                 self.$element.find('ul.oe_mail_msg_menu').toggle();
             });
+            // event: click on "send an email"
+            this.$element.find('div.oe_mail_thread_act').delegate('a.oe_mail_compose', 'click', function (event) {
+                console.log('cacaprout');
+                self.do_action({
+                        type: 'ir.actions.act_window',
+                        res_model: 'mail.compose.message',
+                        views: [[false, 'form']],
+                        view_type: 'form',
+                        view_mode: 'form',
+                        target: 'new',
+                        context: {'active_model': self.params.res_model, 'active_id': self.params.res_id, 'mail.compose.message.mode': 'new'},
+                        key2: 'client_action_multi',
+                });
+                return false;
+            });
+            
         },
         
         destroy: function () {
index 76d6034..05adf4b 100644 (file)
@@ -45,6 +45,7 @@
 
     <ul t-name="Thread" class="oe_mail oe_mail_thread">
         <div class="oe_mail_thread_act">
+            <a href="#" class="oe_mail_compose">Repley by e-mail</a><br />
             <img class="oe_mail_msg_image oe_mail_oe_left" alt="User img"/>
             <div class="oe_mail_msg_content">
                 <textarea class="oe_mail oe_mail_action_textarea" placeholder="Add your comment here..." onfocus="this.value = '';"/><br />
index fa039f2..110d8dd 100644 (file)
@@ -67,6 +67,7 @@ class mail_compose_message(osv.osv_memory):
            :param dict context: several context values will modify the behavior
                                 of the wizard, cfr. the class description.
         """
+        print context
         if context is None:
             context = {}
         result = super(mail_compose_message, self).default_get(cr, uid, fields, context=context)
index d559d67..ae62c21 100644 (file)
@@ -8,17 +8,31 @@
             <field name="arch" type="xml">
                 <form string="Compose Email">
                     <group col="6" colspan="4">
+<!--
                         <field name="model" invisible="1"/>
                         <field name="res_id" invisible="1"/>
+-->
+                       <field name='filter_id'/>
+<!--
                         <field name='filter_id' invisible="context.get('active_model',False)"/>
-                        <field name="email_from" colspan="4" required="1"/>
+-->
+                        <newline/>
+                       <field name="email_from" colspan="4" required="1"/>
                         <field name="email_to" colspan="4" required="1"/>
                         <field name="email_cc" colspan="4"/>
                         <field name="email_bcc" colspan="4"/>
                         <field name="reply_to" colspan="4"/>
                         <field name="subject" colspan="4" widget="char" size="512"/>
+                       <separator string="Debug information" colspan="6"/>
+                       <field name="model"/>
+                        <field name="res_id"/>
+                       <newline/>
+                        <field name="references"/>
+                        <field name="message_id"/>
+<!--
                         <field name="references" invisible="1"/>
                         <field name="message_id" invisible="1"/>
+-->
                     </group>
                     <notebook colspan="4">
                         <page string="Body">