[CLEAN] mail.compose.message: removed form view that was done for Chatter, as this...
authorThibault Delavallée <tde@openerp.com>
Wed, 17 Oct 2012 09:26:42 +0000 (11:26 +0200)
committerThibault Delavallée <tde@openerp.com>
Wed, 17 Oct 2012 09:26:42 +0000 (11:26 +0200)
bzr revid: tde@openerp.com-20121017092642-e27p41f9rqzd2rpm

addons/mail/wizard/mail_compose_message.py
addons/mail/wizard/mail_compose_message_view.xml

index 877a4bf..f4821e8 100644 (file)
@@ -220,27 +220,19 @@ class mail_compose_message(osv.TransientModel):
         if context is None:
             context = {}
         active_ids = context.get('active_ids')
+        print 'odefnzeofiznpenf'
 
         for wizard in self.browse(cr, uid, ids, context=context):
             mass_mail_mode = wizard.composition_mode == 'mass_mail'
             active_model_pool = self.pool.get(wizard.model if wizard.model else 'mail.thread')
 
-            if wizard.content_subtype == 'html':
-                if not wizard.body:
-                    return False
-                body = wizard.body
-            else: # wizard.content_subtype == 'plain':
-                if not wizard.body_text:
-                    return False
-                body = '<pre>%s</pre>' % tools.ustr(wizard.body_text or '')
-
             # wizard works in batch mode: [res_id] or active_ids
             res_ids = active_ids if mass_mail_mode and wizard.model and active_ids else [wizard.res_id]
             for res_id in res_ids:
                 # default values, according to the wizard options
                 post_values = {
                     'subject': wizard.subject if wizard.content_subtype == 'html' else False,
-                    'body': body,
+                    'body': wizard.body if wizard.content_subtype == 'html' else '<pre>%s</pre>' % tools.ustr(wizard.body_text),
                     'parent_id': wizard.parent_id and wizard.parent_id.id,
                     'partner_ids': [(4, partner.id) for partner in wizard.partner_ids],
                     'attachments': [(attach.datas_fname or attach.name, base64.b64decode(attach.datas)) for attach in wizard.attachment_ids],
@@ -254,13 +246,13 @@ class mail_compose_message(osv.TransientModel):
                     post_values['attachments'] += new_attachments
                     post_values.update(email_dict)
                 # post the message
-                id=active_model_pool.message_post(cr, uid, [res_id], type='comment', subtype='mt_comment', context=context, **post_values)
+                active_model_pool.message_post(cr, uid, [res_id], type='comment', subtype='mt_comment', context=context, **post_values)
 
             # post process: update attachments, because id is not necessarily known when adding attachments in Chatter
             # self.pool.get('ir.attachment').write(cr, uid, [attach.id for attach in wizard.attachment_ids], {
             #     'res_id': wizard.id, 'res_model': wizard.model or False}, context=context)
-        
-        return {'type': 'ir.actions.act_window_close', 'res_model':'mail.compose.message', 'id': id}
+
+        return {'type': 'ir.actions.act_window_close'}
 
     def render_message(self, cr, uid, wizard, res_id, context=None):
         """ Generate an email from the template for given (wizard.model, res_id)
index 7329992..8a47b8e 100644 (file)
@@ -6,17 +6,21 @@
             <field name="model">mail.compose.message</field>
             <field name="arch" type="xml">
                 <form string="Compose Email" version="7.0">
-                    <field name="composition_mode" nolabel="1" invisible="1"/>
-                    <field name="model" nolabel="1" invisible="1"/>
-                    <field name="res_id" nolabel="1" invisible="1"/>
-                    <field name="parent_id" nolabel="1" invisible="1"/>
-                    <field name="content_subtype" nolabel="1" invisible="1"/>
+                    <!-- truly invisible fields for control and options -->
+                    <field name="composition_mode" nolabel="1" invisible="0"/>
+                    <field name="model" nolabel="1" invisible="0"/>
+                    <field name="res_id" nolabel="1" invisible="0"/>
+                    <field name="parent_id" nolabel="1" invisible="0"/>
+                    <field name="content_subtype" nolabel="1" invisible="0"/>
+                    <!-- visible wizard -->
                     <group>
-                        <field name="subject" placeholder="Subject..."/>
+                        <field name="subject" placeholder="Subject..."
+                                attrs="{'invisible':[('content_subtype', '=', 'plain')]}"/>/>
                         <field name="partner_ids" widget="many2many_tags" placeholder="Add contacts to notify..."
                                 context="{'force_email':True}"
                                 on_change="onchange_partner_ids(partner_ids)"/>
-                        <field name="is_private" help="If this message is not private, this message will send to all your followers or all followers of the parented message."/>
+                        <field name="is_private"
+                                help="If this message is not private, this message will send to all your followers or all followers of the parented message."/>
                     </group>
                     <notebook>
                         <page string="Body">
                         <button string="Send" name="send_mail" type="object" class="oe_highlight"  />
                         or
                         <button string="Cancel" class="oe_link" special="cancel" />
-                        <!--div class="oe_right">
-                            <button string="" name="toggle_content_subtype" type="object" icon="/mail/static/src/img/formatting.png" 
-                                help="Toggle advanced formatting mode"/>
-                        </div-->
                     </footer>
                 </form>
             </field>
         </record>
 
-        <record model="ir.ui.view" id="email_compose_message_wizard_form_chatter">
-            <field name="name">mail.compose.message.form.chatter</field>
-            <field name="model">mail.compose.message</field>
-            <field name="priority">18</field>
-            <field name="arch" type="xml">
-                <form string="Compose Email" version="7.0" >
-                    <group>
-                        <!-- truly invisible fields for control and options -->
-                        <field name="composition_mode" colspan="2" nolabel="1" invisible="1"/>
-                        <field name="model" colspan="2" nolabel="1" invisible="1"/>
-                        <field name="res_id" colspan="2" nolabel="1" invisible="1"/>
-                        <field name="parent_id" colspan="2" nolabel="1" invisible="1"/>
-                        <field name="content_subtype" colspan="2" nolabel="1" invisible="1"/>
-                        <!-- visible wizard -->
-                        <field name="subject" colspan="2" nolabel="1" placeholder="Subject..."
-                                class="oe_mail_compose_message_subject"
-                                attrs="{'invisible':[('content_subtype', '=', 'plain')]}"/>
-                        <field name="body_text" colspan="2" nolabel="1" placeholder="What are you working on ?"
-                                class="oe_mail_compose_message_body"
-                                attrs="{'invisible':[('content_subtype', '=', 'html')]}"/>
-                        <field name="body" colspan="2" nolabel="1" placeholder="What are you working on ?"
-                                class="oe_mail_compose_message_body_html"
-                                attrs="{'invisible':[('content_subtype', '=', 'plain')]}"/>
-                        <field name="partner_ids" colspan="2" nolabel="1" widget="many2many_tags" placeholder="Add contacts to notify..."
-                                context="{'force_email':True}"
-                                on_change="onchange_partner_ids(partner_ids)"
-                                class="oe_mail_compose_message_partner_ids"/>
-                        <!--field name="is_private" help="If this message is not private, this message will send to all your followers or all followers of the parented message."/-->
-                        <field name="attachment_ids" colspan="2" nolabel="1" widget="many2many_tags"
-                                placeholder="Add attachments..." invisible="1"
-                                class="oe_mail_compose_message_attachment_ids"/>
-                        <!-- void div to display attachments, Chatter-controlled -->
-                        <div colspan="2" class="oe_mail_compose_message_attachments"/>
-                        <!-- buttons, with as few Chatter logic as possible -->
-                        <div>
-                            <button name="send_mail" string="Post message" type="object"
-                                class="oe_mail_compose_message_button_send"/>
-                        </div>
-                        <div class='oe_mail_compose_message_icons'>
-                            <button icon="/mail/static/src/img/attachment.png"
-                                class="oe_mail_compose_message_attachment" string=""
-                                name="dummy"
-                                help="Add an attachment"/>
-                            <button icon="/mail/static/src/img/formatting.png"
-                                class="oe_mail_compose_message_formatting" string=""
-                                type="object" name="toggle_content_subtype"
-                                help="Toggle advanced formatting mode"/>
-                        </div>
-                    </group>
-                </form>
-            </field>
-        </record>
-
         <record id="action_email_compose_message_wizard" model="ir.actions.act_window">
             <field name="name">Compose Email</field>
             <field name="res_model">mail.compose.message</field>