← Back to team overview

openerp-india team mailing list archive

[Bug 1026080] Re: email_template: Compose Email wizard uses wrong record to apply templates

 

As a workaround, I bypassed the "Use a message template", and it works nicely.
Here goes the code of the fixed view, at email_template/wizard/email_compose_message_view.xml:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <record model="ir.ui.view" id="email_compose_message_wizard_inherit_form">
            <field name="name">mail.compose.message.form</field>
            <field name="model">mail.compose.message</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
            <field name="arch" type="xml">
                <data>
                    <xpath expr="//label[@name='placeholder']" position="before">
                        <group attrs="{'invisible':[('use_template','=',False)]}" colspan="4" col="4">
                            <field name="template_id" colspan="3"
                                   on_change="on_change_template(use_template, template_id, email_from, email_to, context)"/>
                            <label string="" name="flexspace" colspan="1"/>
                        </group>
                        <group colspan="1" col="6">
                            <field name="use_template"/>
                             <button icon="gtk-paste" type="object" name="template_toggle" invisible="1"
                                    string="" help="Use a message template" colspan="1"/>
                            <button icon="gtk-save" type="object" name="save_as_template"
                                    string="" help="Save as a new template" colspan="1"/>
                        </group>
                    </xpath>
                </data>
            </field>
        </record>
    </data>
</openerp>

** Patch added: "email_compose_message_view.xml.PATCH"
   https://bugs.launchpad.net/openobject-addons/+bug/1026080/+attachment/3227090/+files/email_compose_message_view.xml.PATCH

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1026080

Title:
  email_template: Compose Email wizard uses wrong record to apply
  templates

Status in OpenERP Addons (modules):
  New

Bug description:
  This was found in Project Issue's "Communication & History" tab, but it's generic to the Email templates:
  (a) Select a Project issue record, and go to "Communication & History" tab, "Send New Email" button
  (b) At the "Compose Email" wizard, click on the button to "Use a message template" and select a previously created template from the list.
  The template will be rendered for an issue that's not the one selected in the first place.

  My debugging effort concluded that, at the beginning of (b), the context['active_id'] is correct.
  The bug arises when you press the "Use a message template" button: this calls a "_reopen()" mehod that forces a reload that changes the context's active_id to the wizard model's records, losing the id of the original record.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1026080/+subscriptions


References