[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>
<field name="name"/>
<field name="mass_mailing_campaign_id"/>
<field name="mass_mailing_campaign_id" readonly="True"/>
</group>
<group>
<field name="template_id"/>
@ -55,10 +55,8 @@
<field name="date"/>
</group>
</group>
<group>
<field name="statistics_ids"/>
</group>
<group>
<group string="Email Statistics">
<field name="statistics_ids" nolabel="1" colspan="2"/>
<group>
<field name="sent"/>
<field name="opened"/>
@ -203,7 +201,7 @@
</group>
</group>
<group>
<field name="mass_mailing_ids"/>
<field name="mass_mailing_ids" readonly="1"/>
</group>
</sheet>
</form>
@ -289,6 +287,13 @@
<field name="res_model">mail.mass_mailing.campaign</field>
<field name="view_type">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>
<!-- MAIL MAIL STATISTICS !-->

View File

@ -36,8 +36,10 @@ class MailMassMailingCreate(osv.TransientModel):
required=True,
),
'model_id': fields.many2one(
'ir.model', 'Model',
'ir.model', 'Document',
required=True,
help='Document on which the mass mailing will run. This must be a '
'valid OpenERP model.',
),
'model_model': fields.related(
'model_id', 'name',
@ -45,7 +47,10 @@ class MailMassMailingCreate(osv.TransientModel):
),
'filter_id': fields.many2one(
'ir.filters', 'Filter',
required=True,
domain="[('model_id', '=', model_model)]",
help='Filter to be applied on the document to find the records to be '
'mailed.',
),
'domain': fields.related(
'filter_id', 'domain',
@ -56,14 +61,20 @@ class MailMassMailingCreate(osv.TransientModel):
domain="[('model_id', '=', model_id)]",
),
'name': fields.char(
'Name', required=True,
'Mailing Name', required=True,
help='Name of the mass mailing.',
),
'mass_mailing_id': fields.many2one(
'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 = {
'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):

View File

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