diff options
| author | Thibault Delavallée <tde@openerp.com> | 2013-07-22 13:23:06 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2013-07-22 13:23:06 +0200 |
| commit | db0cd38559bc704527af856d516c5f61be391f6e (patch) | |
| tree | cebb97b22b99563846307f1ef52c6db66f6a308b | |
| parent | 1d82442202c9a632ef67b10e12d75c2ed9861a00 (diff) | |
[IMP] mail.compose.message: now proposes to work on active_domain
bzr revid: tde@openerp.com-20130722112306-r1u77tyqzk4bknrb
| -rw-r--r-- | addons/mail/wizard/mail_compose_message.py | 15 | ||||
| -rw-r--r-- | addons/mail/wizard/mail_compose_message_view.xml | 3 |
2 files changed, 14 insertions, 4 deletions
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 @@ <field name="reply_to" placeholder="Email address te redirect replies..." attrs="{'invisible':['|', ('same_thread', '=', True), ('composition_mode', '!=', 'mass_mail')], 'required':[('same_thread', '!=', True)]}"/> + <field name="use_active_domain" groups="base.group_no_one" + attrs="{'invisible': [('composition_mode', '!=', 'mass_mail')]}"/> + <field name="active_domain" attrs="{'invisible': [('use_active_domain', '=', False)]}"/> <label for="partner_ids" string="Recipients" attrs="{'invisible':[('composition_mode', '=', 'mass_mail')]}"/> <div groups="base.group_user" |
