[IMP] mail, email_template: improved mass mailing action (renamed, now using a well defined template) + improved form view of mail.compose.message wizard.

bzr revid: tde@openerp.com-20130312133817-y9xztv6gs4ut7ndj
This commit is contained in:
Thibault Delavallee
2013-03-12 14:38:17 +01:00
parent 99063b421f
commit d7e5763dcb
4 changed files with 45 additions and 8 deletions
@@ -11,5 +11,35 @@
</xpath>
</field>
</record>
<!--Definition of an email template with an empty body that will be used in opportunity mailing. Used to give a
basis for email recipients, name and to ease the definition of a further elaborated template. -->
<record id="partner_template" model="email.template">
<field name="name">Partner Mass Mail</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="auto_delete" eval="True"/>
<field name="partner_to">${object.id}</field>
</record>
<!-- Replace the default mass-mailing wizard in base with the composition wizard -->
<act_window name="Partner Mass Mailing"
res_model="mail.compose.message"
src_model="res.partner"
view_mode="form"
multi="True"
target="new"
key2="client_action_multi"
id="base.action_partner_mass_mail"
context="{
'default_composition_mode': 'mass_mail',
'default_partner_to': '${object.id or \'\'}',
'default_use_template': True,
'default_template_id': ref('partner_template'),
}"/>
<record id="partner_template" model="email.template">
<field name="ref_ir_act_window" ref="base.action_partner_mass_mail"/>
</record>
</data>
</openerp>
@@ -8,9 +8,12 @@
<field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='subject']" position="after">
<field name="partner_to" groups="base.group_no_one"/>
<field name="email_to" groups="base.group_no_one"/>
<field name="email_cc" groups="base.group_no_one"/>
<field name="partner_to" groups="base.group_no_one"
attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>/>
<field name="email_to" groups="base.group_no_one"
attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>/>
<field name="email_cc" groups="base.group_no_one"
attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>/>
</xpath>
<xpath expr="//footer" position="inside">
<group class="oe_right" col="1">
@@ -127,6 +127,7 @@ class mail_compose_message(osv.TransientModel):
_defaults = {
'composition_mode': 'comment',
'email_from': lambda self, cr, uid, ctx={}: self.pool.get('mail.mail')._get_default_from(cr, uid, context=ctx),
'body': lambda self, cr, uid, ctx={}: '',
'subject': lambda self, cr, uid, ctx={}: False,
'partner_ids': lambda self, cr, uid, ctx={}: [],
@@ -16,12 +16,14 @@
<field name="email_from"
attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
<field name="subject" placeholder="Subject..." required="True"/>
<field name="post" groups="base.group_no_one"/>
<field name="post" groups="base.group_no_one"
attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
<field name="notify" groups="base.group_no_one"
attrs="{'invisible':[('post', '!=', True)]}"/>
<field name="same_thread"/>
attrs="{'invisible':['|', ('post', '!=', True), ('composition_mode', '!=', 'mass_mail')]}"/>
<field name="same_thread"
attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
<field name="reply_to" placeholder="Email address te redirect replies..."
attrs="{'invisible':[('same_thread', '=', True)],
attrs="{'invisible':['|', ('same_thread', '=', True), ('composition_mode', '!=', 'mass_mail')],
'required':[('same_thread', '!=', True)]}"/>
<label for="partner_ids" string="Recipients"
attrs="{'invisible':[('composition_mode', '=', 'mass_mail')]}"/>
@@ -58,7 +60,7 @@
</record>
<!-- Replace the default mass-mailing wizard in base with the composition wizard -->
<act_window name="Mass Mailing"
<act_window name="Partner Mass Mailing"
res_model="mail.compose.message"
src_model="res.partner"
view_mode="form"
@@ -70,5 +72,6 @@
'default_composition_mode': 'mass_mail',
'default_partner_to': '${object.id or \'\'}',
}"/>
</data>
</openerp>