diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 7685a27f1ed..02fac7f010f 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -73,6 +73,7 @@ class mail_compose_message(osv.TransientModel): res_id = context.get('default_res_id', context.get('active_id')) message_id = context.get('default_parent_id', context.get('message_id', context.get('active_id'))) active_ids = context.get('active_ids') + result['active_domain'] = '%s' % context.get('active_domain', []) # get default values according to the composition mode if composition_mode == 'reply': @@ -112,6 +113,8 @@ class mail_compose_message(osv.TransientModel): 'partner_ids': fields.many2many('res.partner', 'mail_compose_message_res_partner_rel', 'wizard_id', 'partner_id', 'Additional contacts'), + 'use_active_domain': fields.boolean('Use active domain'), + 'active_domain': fields.char('Active domain', readonly=True), 'post': fields.boolean('Post a copy in the document', help='Post a copy of the message on the document communication history.'), 'notify': fields.boolean('Notify followers', @@ -127,9 +130,7 @@ class mail_compose_message(osv.TransientModel): _defaults = { 'composition_mode': 'comment', 'body': lambda self, cr, uid, ctx={}: '', - 'subject': lambda self, cr, uid, ctx={}: False, 'partner_ids': lambda self, cr, uid, ctx={}: [], - 'notify': lambda self, cr, uid, ctx={}: False, 'post': lambda self, cr, uid, ctx={}: True, 'same_thread': lambda self, cr, uid, ctx={}: True, } @@ -238,8 +239,14 @@ class mail_compose_message(osv.TransientModel): context['thread_model'] = wizard.model active_model_pool = self.pool['mail.thread'] - # wizard works in batch mode: [res_id] or active_ids - res_ids = active_ids if mass_mail_mode and wizard.model and active_ids else [wizard.res_id] + # wizard works in batch mode: [res_id] or active_ids or active_domain + if mass_mail_mode and wizard.use_active_domain and wizard.model: + res_ids = self.pool[wizard.model].search(cr, uid, eval(wizard.active_domain), context=context) + elif mass_mail_mode and wizard.model and active_ids: + res_ids = active_ids + else: + res_ids = [wizard.res_id] + for res_id in res_ids: # mail.message values, according to the wizard options post_values = { diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml index 1ca07b6a94c..c8c877e37fa 100644 --- a/addons/mail/wizard/mail_compose_message_view.xml +++ b/addons/mail/wizard/mail_compose_message_view.xml @@ -25,6 +25,9 @@ + +