[iMP] small improvements
bzr revid: fp@tinyerp.com-20140412232159-1y35hdpaahy633tb
This commit is contained in:
parent
3df4eb0f72
commit
e9cf53934b
|
@ -142,13 +142,13 @@ class MassMailing(osv.Model):
|
||||||
|
|
||||||
def _get_mailing_model(self, cr, uid, context=None):
|
def _get_mailing_model(self, cr, uid, context=None):
|
||||||
return [
|
return [
|
||||||
('res.partner', 'Customers'),
|
('res.partner', _('Customers')),
|
||||||
('mail.mass_mailing.contact', 'Contacts')
|
('mail.mass_mailing.contact', _('Mailing List'))
|
||||||
]
|
]
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Subject', required=True),
|
'name': fields.char('Subject', required=True),
|
||||||
'email_from': fields.char('From'),
|
'email_from': fields.char('From', required=True),
|
||||||
'date': fields.datetime('Date'),
|
'date': fields.datetime('Date'),
|
||||||
'body_html': fields.html('Body'),
|
'body_html': fields.html('Body'),
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class MassMailing(osv.Model):
|
||||||
ondelete='set null',
|
ondelete='set null',
|
||||||
),
|
),
|
||||||
'state': fields.selection(
|
'state': fields.selection(
|
||||||
[('draft', 'Schedule'), ('test', 'Tested'), ('done', 'Sent')], string='Status', required=True,
|
[('draft', 'Draft'), ('test', 'Tested'), ('done', 'Sent')], string='Status', required=True,
|
||||||
),
|
),
|
||||||
'color': fields.related(
|
'color': fields.related(
|
||||||
'mass_mailing_campaign_id', 'color',
|
'mass_mailing_campaign_id', 'color',
|
||||||
|
@ -175,7 +175,7 @@ class MassMailing(osv.Model):
|
||||||
'reply_to': fields.char('Reply To'),
|
'reply_to': fields.char('Reply To'),
|
||||||
|
|
||||||
# Target Emails
|
# Target Emails
|
||||||
'mailing_model': fields.selection(_get_mailing_model, string='Model'),
|
'mailing_model': fields.selection(_get_mailing_model, string='Recipients Model'),
|
||||||
'mailing_domain': fields.char('Domain'),
|
'mailing_domain': fields.char('Domain'),
|
||||||
'contact_list_ids': fields.many2many(
|
'contact_list_ids': fields.many2many(
|
||||||
'mail.mass_mailing.list', 'mail_mass_mailing_list_rel',
|
'mail.mass_mailing.list', 'mail_mass_mailing_list_rel',
|
||||||
|
@ -212,16 +212,19 @@ class MassMailing(osv.Model):
|
||||||
#------------------------------------------------------
|
#------------------------------------------------------
|
||||||
# Views & Actions
|
# Views & Actions
|
||||||
#------------------------------------------------------
|
#------------------------------------------------------
|
||||||
|
def on_change_model(self, cr, uid, ids, mailing_model, list_ids, context=None):
|
||||||
def on_change_mailing_model(self, cr, uid, ids, mailing_model, context=None):
|
value = {}
|
||||||
values = {
|
if mailing_model=='mail.mass_mailing.contact':
|
||||||
'contact_list_ids': [],
|
if list_ids and list_ids[0][0]==6 and list_ids[0][2]:
|
||||||
'contact_nbr': 0,
|
value['mailing_domain'] = "[('list_id', 'in', ["+','.join(map(str, list_ids[0][2]))+"])]"
|
||||||
'auto_reply_to_available': not mailing_model in self._get_private_models(context),
|
value['contact_nbr'] = 5
|
||||||
'reply_in_thread': not mailing_model in self._get_private_models(context),
|
else:
|
||||||
'reply_specified': mailing_model in self._get_private_models(context)
|
value['mailing_domain'] = "[('list_id', '=', False)]"
|
||||||
}
|
value['contact_nbr'] = 0
|
||||||
return {'value': values}
|
else:
|
||||||
|
value['mailing_domain'] = False
|
||||||
|
value['contact_nbr'] = 0
|
||||||
|
return {'value': value}
|
||||||
|
|
||||||
def on_change_reply_specified(self, cr, uid, ids, reply_specified, reply_in_thread, context=None):
|
def on_change_reply_specified(self, cr, uid, ids, reply_specified, reply_in_thread, context=None):
|
||||||
if reply_specified == reply_in_thread:
|
if reply_specified == reply_in_thread:
|
||||||
|
@ -271,15 +274,15 @@ class MassMailing(osv.Model):
|
||||||
else:
|
else:
|
||||||
return self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, 'mass_mailing.action_contact_to_mailing_list')
|
return self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, 'mass_mailing.action_contact_to_mailing_list')
|
||||||
|
|
||||||
def action_new_list(self, cr, uid, ids, context=None):
|
def action_domain_select(self, cr, uid, ids, context=None):
|
||||||
mailing = self.browse(cr, uid, ids[0], context=context)
|
mailing = self.browse(cr, uid, ids[0], context=context)
|
||||||
action_id = self._get_model_to_list_action_id(cr, uid, mailing.mailing_model, context=context)
|
ctx = dict(
|
||||||
ctx = dict(context,
|
context,
|
||||||
search_default_not_opt_out=True,
|
search_default_not_opt_out=True,
|
||||||
view_manager_highlight=[action_id],
|
view_manager_highlight=[action_id], # To Change
|
||||||
default_name=mailing.name,
|
default_mass_mailing_id=ids[0],
|
||||||
default_mass_mailing_id=ids[0],
|
default_model=mailing.mailing_model
|
||||||
default_model=mailing.mailing_model)
|
)
|
||||||
return {
|
return {
|
||||||
'name': _('Choose Recipients'),
|
'name': _('Choose Recipients'),
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
|
|
|
@ -179,110 +179,116 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Mass Mailing" version="7.0">
|
<form string="Mass Mailing" version="7.0">
|
||||||
<header>
|
<header>
|
||||||
<field name="state" widget="statusbar" clickable="True"/>
|
|
||||||
<button name="action_test_mailing" type="object"
|
<button name="action_test_mailing" type="object"
|
||||||
class="oe_highlight" string="Test Mailing"/>
|
class="oe_highlight" string="Test Mailing"/>
|
||||||
<button name="send_mail" type="object"
|
<button name="send_mail" type="object"
|
||||||
class="oe_highlight" string="Send to All"/>
|
class="oe_highlight" string="Send to All"/>
|
||||||
|
<field name="state" widget="statusbar"/>
|
||||||
</header>
|
</header>
|
||||||
<sheet>
|
<sheet>
|
||||||
<div class="oe_form_box_info oe_text_center"
|
<div class="oe_form_box_info oe_text_center" attrs="{'invisible': [('scheduled', '=', 0)]}">
|
||||||
attrs="{'invisible': [('scheduled', '=', 0)]}">
|
|
||||||
<p>
|
<p>
|
||||||
<strong><field name="scheduled" class="oe_inline"/>emails are in queue
|
<strong><field name="scheduled" class="oe_inline"/>emails are in queue
|
||||||
and will be sent soon.</strong>
|
and will be sent soon.</strong>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="oe_button_box pull-right" attrs="{'invisible': [('total', '=', 0)]}">
|
||||||
|
<button name="%(action_mail_mass_mailing_report)d"
|
||||||
|
type="action" class="oe_stat_button">
|
||||||
|
<field name="received_ratio" string="Received" widget="percentpie"/>
|
||||||
|
</button>
|
||||||
|
<button name="%(action_mail_mass_mailing_report)d"
|
||||||
|
type="action" class="oe_stat_button">
|
||||||
|
<field name="opened_ratio" string="Opened" widget="percentpie"/>
|
||||||
|
</button>
|
||||||
|
<button name="%(action_mail_mass_mailing_report)d"
|
||||||
|
type="action" class="oe_stat_button">
|
||||||
|
<field name="replied_ratio" string="Replied" widget="percentpie"/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="oe_button_box" attrs="{'invisible': [('total', '=', 0)]}" style="margin-bottom: 32px">
|
||||||
|
<button name="%(action_mail_mass_mailing_report)d" type="action"
|
||||||
|
icon="fa-envelope-o" class="oe_stat_button">
|
||||||
|
<field name="total" string="Emails" widget="statinfo"/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<field name="email_from"/>
|
||||||
<field name="email_from"/>
|
<field name="name"/>
|
||||||
<field name="name"/>
|
|
||||||
</group>
|
|
||||||
<group>
|
|
||||||
<div class="oe_right oe_button_box" name="buttons">
|
|
||||||
<div>
|
|
||||||
<button name="action_see_recipients" type="object"
|
|
||||||
icon="fa-user" class="oe_stat_button">
|
|
||||||
<field name="contact_nbr" string="Recipients" widget="statinfo"/>
|
|
||||||
</button>
|
|
||||||
<button name="%(action_mail_mass_mailing_report)d" type="action"
|
|
||||||
icon="fa-envelope-o" class="oe_stat_button">
|
|
||||||
<field name="total" string="Emails" widget="statinfo"/>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div style="margin-top: 8px;"
|
|
||||||
attrs="{'invisible': [('total', '=', 0)]}">
|
|
||||||
<button name="%(action_mail_mass_mailing_report)d"
|
|
||||||
type="action" class="oe_stat_button">
|
|
||||||
<field name="received_ratio" string="Received" widget="percentpie"/>
|
|
||||||
</button>
|
|
||||||
<button name="%(action_mail_mass_mailing_report)d"
|
|
||||||
type="action" class="oe_stat_button">
|
|
||||||
<field name="opened_ratio" string="Opened" widget="percentpie"/>
|
|
||||||
</button>
|
|
||||||
<button name="%(action_mail_mass_mailing_report)d"
|
|
||||||
type="action" class="oe_stat_button">
|
|
||||||
<field name="replied_ratio" string="Replied" widget="percentpie"/>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div style="margin-top: 8px;"
|
|
||||||
attrs="{'invisible': [('total', '=', 0)]}">
|
|
||||||
<button name="%(action_mail_mass_mailing_report)d"
|
|
||||||
type="action" class="oe_stat_button oe_inline">
|
|
||||||
<field name="opened_dayly" string="Opened Daily" widget="barchart"/>
|
|
||||||
</button>
|
|
||||||
<button name="%(action_mail_mass_mailing_report)d"
|
|
||||||
type="action" class="oe_stat_button oe_inline">
|
|
||||||
<field name="replied_dayly" string="Replied Daily" widget="barchart"/>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</group>
|
|
||||||
</group>
|
|
||||||
<group>
|
|
||||||
<label for="reply_to"/>
|
|
||||||
<div>
|
|
||||||
<field name="auto_reply_to_available" invisible="1"/>
|
|
||||||
<field name="reply_in_thread" class="oe_inline"
|
|
||||||
on_change="on_change_reply_in_thread(reply_specified, reply_in_thread, context)"
|
|
||||||
attrs="{'readonly': [('auto_reply_to_available', '=', False)]}"/>
|
|
||||||
<span attrs="{'invisible': [('auto_reply_to_available', '=', False)]}">
|
|
||||||
Replies go into the original document
|
|
||||||
</span>
|
|
||||||
<span class="oe_grey" attrs="{'invisible': [('auto_reply_to_available', '=', True)]}">
|
|
||||||
Replies go into the original document (not available for those recipients)
|
|
||||||
</span>
|
|
||||||
<br />
|
|
||||||
<field name="reply_specified" class="oe_inline"
|
|
||||||
on_change="on_change_reply_specified(reply_specified, reply_in_thread, context)"/> Use a specific reply-to address
|
|
||||||
<field name="reply_to" class="oe_inline"
|
|
||||||
style="margin-left: 8px;"
|
|
||||||
attrs="{'required': [('reply_specified', '=', True)]}"/>
|
|
||||||
</div>
|
|
||||||
<label for="mailing_model" string="Recipients"/>
|
<label for="mailing_model" string="Recipients"/>
|
||||||
<div>
|
<div>
|
||||||
<field name="mailing_model" widget="radio"
|
<field name="mailing_domain" invisible="1"/>
|
||||||
on_change='on_change_mailing_model(mailing_model, context)'/>
|
<field name="mailing_model" widget="radio" style="margin-bottom: 8px"
|
||||||
|
on_change="on_change_model(mailing_model, contact_list_ids)"/>
|
||||||
|
|
||||||
<label for="contact_list_ids" string="Mailing Lists" style="display: inline-block; min-width: 90px;"/>
|
<div attrs="{'invisible': [('mailing_model', '=', 'mail.mass_mailing.contact')]}">
|
||||||
<field name="contact_list_ids" widget="many2many_tags" options="{'no_create': True}"
|
<button class="oe_link" type='object' name='action_domain_select' attrs="{'invisible': [('contact_nbr', '>', '0')]}">
|
||||||
class="oe_inline" placeholder="Choose mailing lists"
|
<span class="fa fa-arrow-right"> Select Recipients</span>
|
||||||
on_change="on_change_contact_list_ids(mailing_model, contact_list_ids, context)"/>
|
</button>
|
||||||
<span style="margin-left: 8px; margin-right: 8px">or</span>
|
</div>
|
||||||
<button string='Create a New List' class="oe_link" type='object' name='action_new_list'/><br />
|
<div attrs="{'invisible': [('mailing_model', '<>', 'mail.mass_mailing.contact')]}">
|
||||||
|
<label for="contact_list_ids" string="Select mailing lists:" class="oe_edit_only"/>
|
||||||
<field name="contact_ab_pc" groups="mass_mailing.group_mass_mailing_campaign"/>
|
<field name="contact_list_ids" widget="many2many_tags"
|
||||||
|
placeholder="Select mailing lists..." class="oe_inline"
|
||||||
|
on_change="on_change_model(mailing_model, contact_list_ids)"/>
|
||||||
|
</div>
|
||||||
|
<div attrs="{'invisible': [('contact_nbr', '<', 1)]}">
|
||||||
|
<strong>
|
||||||
|
<field name="contact_nbr" class="oe_inline"/> Recipients
|
||||||
|
</strong>
|
||||||
|
<button class="oe_link" type='object' name='action_domain_select' attrs="{'invisible': [('mailing_model', '=', 'mail.mass_mailing.contact')]}">
|
||||||
|
<span class="fa fa-arrow-right"> Change Selection</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<field name="date" readonly="True" groups="mass_mailing.group_mass_mailing_campaign"
|
|
||||||
attrs="{'invisible': [('state', '!=', 'done')]}"/>
|
|
||||||
<field name="mass_mailing_campaign_id" groups="mass_mailing.group_mass_mailing_campaign"/>
|
|
||||||
<label for="body_html" string="Email"/>
|
|
||||||
<button name="action_edit_html" type="object" string="Edit Mail Content"
|
|
||||||
class="oe_link" style="margin-left: 8px"/>
|
|
||||||
<field name="body_html"/>
|
|
||||||
</group>
|
</group>
|
||||||
|
<notebook>
|
||||||
|
<page string="Mail Body">
|
||||||
|
<button name="action_edit_html" type="object" string="Design Email" class="oe_highlight"/>
|
||||||
|
<div attrs="{'invisible' : ['|', ('body_html','!=',False), ('contact_nbr', '<', 1)]}" class="oe_view_nocontent oe_clear">
|
||||||
|
<p class="oe_view_nocontent_create oe_edit_only">
|
||||||
|
Click to design your email.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<field name="body_html" readonly="1"/>
|
||||||
|
</page><page string="Options">
|
||||||
|
<group>
|
||||||
|
<group string="Campaign" groups="mass_mailing.group_mass_mailing_campaign">
|
||||||
|
<field name="mass_mailing_campaign_id"/>
|
||||||
|
<label for="contact_ab_pc"/>
|
||||||
|
<div>
|
||||||
|
<field name="contact_ab_pc" class="oe_inline"/> %
|
||||||
|
</div>
|
||||||
|
</group><group>
|
||||||
|
<field name="date"/>
|
||||||
|
</group><group>
|
||||||
|
<label for="reply_to"/>
|
||||||
|
<div>
|
||||||
|
<field name="auto_reply_to_available" invisible="1"/>
|
||||||
|
<field name="reply_in_thread" class="oe_inline"
|
||||||
|
on_change="on_change_reply_in_thread(reply_specified, reply_in_thread, context)"
|
||||||
|
attrs="{'readonly': [('auto_reply_to_available', '=', False)]}"/>
|
||||||
|
<span attrs="{'invisible': [('auto_reply_to_available', '=', False)]}">
|
||||||
|
Replies go into the original document
|
||||||
|
</span>
|
||||||
|
<span class="oe_grey" attrs="{'invisible': [('auto_reply_to_available', '=', True)]}">
|
||||||
|
Replies go into the original document (not available for those recipients)
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
<field name="reply_specified" class="oe_inline"
|
||||||
|
on_change="on_change_reply_specified(reply_specified, reply_in_thread, context)"/> Use a specific reply-to address
|
||||||
|
<field name="reply_to" class="oe_inline"
|
||||||
|
style="margin-left: 8px;"
|
||||||
|
attrs="{'required': [('reply_specified', '=', True)]}"/>
|
||||||
|
</div>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
|
||||||
|
|
||||||
</sheet>
|
</sheet>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
|
Loading…
Reference in New Issue