summaryrefslogtreecommitdiff
path: root/addons/mass_mailing/wizard/mail_compose_message.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2013-09-12 12:09:09 +0200
committerThibault Delavallée <tde@openerp.com>2013-09-12 12:09:09 +0200
commitf8922d6b168b1563cfbaa437f1039e4c7e4fedd0 (patch)
tree825f64841b096e73b27aad0bc74534715fdebd33 /addons/mass_mailing/wizard/mail_compose_message.py
parentf5639479dbd6102013d64bf6e9059cb9ef68ea99 (diff)
[IMP] [ADD] mass_mailing: added a wizard to create new segments.
It can be called directly from within the campaign form view, using a button. It allows to easily create new segments and launch the composer. bzr revid: tde@openerp.com-20130912100909-ofalececxn64a389
Diffstat (limited to 'addons/mass_mailing/wizard/mail_compose_message.py')
-rw-r--r--addons/mass_mailing/wizard/mail_compose_message.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/addons/mass_mailing/wizard/mail_compose_message.py b/addons/mass_mailing/wizard/mail_compose_message.py
index 2b36389cb7b..4fe858734fe 100644
--- a/addons/mass_mailing/wizard/mail_compose_message.py
+++ b/addons/mass_mailing/wizard/mail_compose_message.py
@@ -41,17 +41,21 @@ class MailComposeMessage(osv.TransientModel):
}
_defaults = {
- 'use_mass_mailing_campaign': True,
+ 'use_mass_mailing_campaign': False,
}
- def onchange_mass_mail_campaign_id(self, cr, uid, ids, mass_mail_campaign_id, context=None):
+ def onchange_mass_mail_campaign_id(self, cr, uid, ids, mass_mailing_campaign_id, mass_mail_segment_id, context=None):
+ if mass_mail_segment_id:
+ segment = self.pool['mail.mass_mailing.segment'].browse(cr, uid, mass_mail_segment_id, context=context)
+ if segment.mass_mailing_campaign_id.id == mass_mailing_campaign_id:
+ return {}
return {'value': {'mass_mailing_segment_id': False}}
def render_message_batch(self, cr, uid, wizard, res_ids, context=None):
""" Override method that generated the mail content by adding the mass
mailing campaign, when doing pure email mass mailing. """
res = super(MailComposeMessage, self).render_message_batch(cr, uid, wizard, res_ids, context=context)
- if wizard.composition_mode == 'mass_mail' and wizard.mass_mailing_segment_id: # TODO: which kind of mass mailing ?
+ if wizard.composition_mode == 'mass_mail' and wizard.use_mass_mailing_campaign and wizard.mass_mailing_segment_id: # TODO: which kind of mass mailing ?
for res_id in res_ids:
res[res_id]['mass_mailing_segment_id'] = wizard.mass_mailing_segment_id.id
return res