[IMP] mass mailing: improvements :

- improved mass mailing wizard creation (everything is showed, better alignment, filter_id required, added default document on Partner)
- campaign: o2m is now readonly in form view, added an empty list help

bzr revid: tde@openerp.com-20130917085003-yof5gfy68y56ougf
This commit is contained in:
Thibault Delavallée 2013-09-17 10:50:03 +02:00
parent 03ff00b63c
commit fb4ab9dd0c
3 changed files with 70 additions and 43 deletions

View File

@ -47,7 +47,7 @@
<group> <group>
<group> <group>
<field name="name"/> <field name="name"/>
<field name="mass_mailing_campaign_id"/> <field name="mass_mailing_campaign_id" readonly="True"/>
</group> </group>
<group> <group>
<field name="template_id"/> <field name="template_id"/>
@ -55,10 +55,8 @@
<field name="date"/> <field name="date"/>
</group> </group>
</group> </group>
<group> <group string="Email Statistics">
<field name="statistics_ids"/> <field name="statistics_ids" nolabel="1" colspan="2"/>
</group>
<group>
<group> <group>
<field name="sent"/> <field name="sent"/>
<field name="opened"/> <field name="opened"/>
@ -203,7 +201,7 @@
</group> </group>
</group> </group>
<group> <group>
<field name="mass_mailing_ids"/> <field name="mass_mailing_ids" readonly="1"/>
</group> </group>
</sheet> </sheet>
</form> </form>
@ -289,6 +287,13 @@
<field name="res_model">mail.mass_mailing.campaign</field> <field name="res_model">mail.mass_mailing.campaign</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field> <field name="view_mode">kanban,tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new mass mailing campaign.
</p><p>
Create a campaign to structure mass mailing and get analysis from email status.
</p>
</field>
</record> </record>
<!-- MAIL MAIL STATISTICS !--> <!-- MAIL MAIL STATISTICS !-->

View File

@ -36,8 +36,10 @@ class MailMassMailingCreate(osv.TransientModel):
required=True, required=True,
), ),
'model_id': fields.many2one( 'model_id': fields.many2one(
'ir.model', 'Model', 'ir.model', 'Document',
required=True, required=True,
help='Document on which the mass mailing will run. This must be a '
'valid OpenERP model.',
), ),
'model_model': fields.related( 'model_model': fields.related(
'model_id', 'name', 'model_id', 'name',
@ -45,7 +47,10 @@ class MailMassMailingCreate(osv.TransientModel):
), ),
'filter_id': fields.many2one( 'filter_id': fields.many2one(
'ir.filters', 'Filter', 'ir.filters', 'Filter',
required=True,
domain="[('model_id', '=', model_model)]", domain="[('model_id', '=', model_model)]",
help='Filter to be applied on the document to find the records to be '
'mailed.',
), ),
'domain': fields.related( 'domain': fields.related(
'filter_id', 'domain', 'filter_id', 'domain',
@ -56,14 +61,20 @@ class MailMassMailingCreate(osv.TransientModel):
domain="[('model_id', '=', model_id)]", domain="[('model_id', '=', model_id)]",
), ),
'name': fields.char( 'name': fields.char(
'Name', required=True, 'Mailing Name', required=True,
help='Name of the mass mailing.',
), ),
'mass_mailing_id': fields.many2one( 'mass_mailing_id': fields.many2one(
'mail.mass_mailing', 'Mass Mailing', 'mail.mass_mailing', 'Mass Mailing',
), ),
} }
def _get_default_model_id(self, cr, uid, context=None):
model_ids = self.pool['ir.model'].search(cr, uid, [('model', '=', 'res.partner')], context=context)
return model_ids and model_ids[0] or False
_defaults = { _defaults = {
'model_id': lambda self, cr, uid, ctx=None: self._get_default_model_id(cr, uid, context=ctx),
} }
def on_change_model_id(self, cr, uid, ids, model_id, context=None): def on_change_model_id(self, cr, uid, ids, model_id, context=None):

View File

@ -11,47 +11,58 @@
<group> <group>
<field name="model_model" invisible="1"/> <field name="model_model" invisible="1"/>
<field name="domain" invisible="1"/> <field name="domain" invisible="1"/>
<p class="oe_grey" colspan="2"
attrs="{'invisible': [('mass_mailing_campaign_id', '!=', False)]}">
Please choose a mass mailing campaign that will hold the new mailing.
</p>
<field name="mass_mailing_campaign_id"/>
<p class="oe_grey" colspan="2" <label for="mass_mailing_campaign_id"/>
attrs="{'invisible': ['|', ('model_id', '!=', False), ('mass_mailing_campaign_id', '=', False)]}"> <div>
Please choose a model on which you will run the mass mailing. <field name="mass_mailing_campaign_id"/>
</p> <p class="oe_grey"
<field name="model_id" attrs="{'invisible': [('mass_mailing_campaign_id', '!=', False)]}">
on_change="on_change_model_id(model_id, context)" Please choose a mass mailing campaign that will hold the new mailing.
attrs="{'invisible': [('mass_mailing_campaign_id', '=', False)]}"/> </p>
</div>
<p class="oe_grey" colspan="2" <label for="model_id"/>
attrs="{'invisible': ['|', ('filter_id', '!=', False), ('model_id', '=', False)]}"> <div>
Please choose a filter that will be applied on the model <field name="model_id"
to find the records on which you will run the mass mailing. on_change="on_change_model_id(model_id, context)"/>
</p> <p class="oe_grey"
<field name="filter_id" attrs="{'invisible': [('model_id', '!=', False)]}">
on_change="on_change_filter_id(filter_id, context)" Please choose a model on which you will run the mass mailing.
attrs="{'invisible': [('model_id', '=', False)]}"/> </p>
</div>
<p class="oe_grey" colspan="2" <label for="filter_id"/>
attrs="{'invisible': ['|', ('template_id', '!=', False), ('filter_id', '=', False)]}"> <div>
Please choose the template to use to render the emails <field name="filter_id"
to send. on_change="on_change_filter_id(filter_id, context)"/>
</p> <p class="oe_grey"
<field name="template_id" attrs="{'invisible': [('filter_id', '!=', False)]}">
attrs="{'invisible': [('filter_id', '=', False)]}"/> Please choose a filter that will be applied on the model
to find the records on which you will run the mass mailing.
</p>
</div>
<p class="oe_grey" colspan="2" <label for="model_id"/>
attrs="{'invisible': ['|', ('name', '!=', False), ('template_id', '=', False)]}"> <div>
Please choose the name of the mailing. <field name="template_id"/>
</p> <p class="oe_grey"
<field name="name" attrs="{'invisible': [('template_id', '!=', False)]}">
attrs="{'invisible': [('template_id', '=', False)]}"/> Please choose the template to use to render the emails
to send.
</p>
</div>
<label for="name"/>
<div>
<field name="name"/>
<p class="oe_grey"
attrs="{'invisible': [('name', '!=', False)]}">
Please choose the name of the mailing.
</p>
</div>
<button name="launch_composer" type="object" <button name="launch_composer" type="object"
string="Create mailing and launch email composer" string="Create mailing and launch email composer"/>
attrs="{'invisible': [('name', '=', False)]}"/>
</group> </group>
</form> </form>
</field> </field>