From 55fc583f36b4764592d196e2f5d3c7b8ded50077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 15 Apr 2014 16:33:43 +0200 Subject: [PATCH] [REM] mail: compose message: removed unnecessary code bzr revid: tde@openerp.com-20140415143343-on2d3j92o6zifq59 --- .../wizard/mail_compose_message.py | 15 -------------- addons/mail/wizard/mail_compose_message.py | 20 ------------------- .../mail/wizard/mail_compose_message_view.xml | 5 +---- .../models/mass_mailing.py | 6 ------ .../mass_mailing_crm/models/mass_mailing.py | 6 ------ 5 files changed, 1 insertion(+), 51 deletions(-) diff --git a/addons/email_template/wizard/mail_compose_message.py b/addons/email_template/wizard/mail_compose_message.py index 61a7a7045a4..00858e654bf 100644 --- a/addons/email_template/wizard/mail_compose_message.py +++ b/addons/email_template/wizard/mail_compose_message.py @@ -56,21 +56,6 @@ class mail_compose_message(osv.TransientModel): ) return res - def get_recipients_data(self, cr, uid, values, context=None): - if values['composition_mode'] != 'mass_mail': - return super(mail_compose_message, self).get_recipients_data(cr, uid, values, context=context) - model, res_id, template_id = values['model'], values['res_id'], values.get('template_id') - active_ids = context.get('active_ids', list()) - if not active_ids or not template_id: - return False - template = self.pool['email.template'].browse(cr, uid, template_id, context=context) - partner_to = self.render_template_batch(cr, uid, template.partner_to, model, active_ids[:3], context=context) - partner_ids = [int(data) for key, data in partner_to.iteritems() if data] - rec_names = [rec_name[1] for rec_name in self.pool['res.partner'].name_get(cr, SUPERUSER_ID, partner_ids, context=context)] - recipients = ', '.join(rec_names) - recipients += ' and %d more.' % (len(active_ids) - 3) if len(active_ids) > 3 else '.' - return recipients - _columns = { 'template_id': fields.many2one('email.template', 'Use template', select=True), } diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 74f8d2f8e57..52bdbf8ebf1 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -82,7 +82,6 @@ class mail_compose_message(osv.TransientModel): vals['active_domain'] = '%s' % context.get('active_domain') if result['composition_mode'] == 'comment': vals.update(self.get_record_data(cr, uid, result, context=context)) - result['recipients_data'] = self.get_recipients_data(cr, uid, result, context=context) for field in vals: if field in fields: @@ -112,8 +111,6 @@ class mail_compose_message(osv.TransientModel): 'partner_ids': fields.many2many('res.partner', 'mail_compose_message_res_partner_rel', 'wizard_id', 'partner_id', 'Additional Contacts'), - 'recipients_data': fields.text(string='Recipients Data', - help='Helper field used in mass mailing to display a sample of recipients'), 'use_active_domain': fields.boolean('Use active domain'), 'active_domain': fields.char('Active domain', readonly=True), 'attachment_ids': fields.many2many('ir.attachment', @@ -164,23 +161,6 @@ class mail_compose_message(osv.TransientModel): not want that feature in the wizard. """ return - def get_recipients_data(self, cr, uid, values, context=None): - """ Returns a string explaining the targetted recipients, to ease the use - of the wizard. """ - composition_mode, model, res_id = values['composition_mode'], values['model'], values['res_id'] - if composition_mode == 'comment' and model and res_id: - doc_name = self.pool[model].name_get(cr, uid, [res_id], context=context) - return doc_name and 'Followers of %s' % doc_name[0][1] or False - elif composition_mode == 'mass_post' and model: - if 'active_domain' in context: - active_ids = self.pool[model].search(cr, uid, eval(context['active_domain']), limit=100, context=context) - else: - active_ids = context.get('active_ids', list()) - if active_ids: - name_gets = [rec_name[1] for rec_name in self.pool[model].name_get(cr, uid, active_ids[:3], context=context)] - return 'Followers of selected documents (' + ', '.join(name_gets) + len(active_ids) > 3 and ', ...' or '' + ')' - return False - def get_record_data(self, cr, uid, values, context=None): """ Returns a defaults-like dict with initial values for the composition wizard when sending an email related a previous email (parent_id) or diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml index 4bab178ac53..5b6bfc50439 100644 --- a/addons/mail/wizard/mail_compose_message_view.xml +++ b/addons/mail/wizard/mail_compose_message_view.xml @@ -36,11 +36,8 @@ Email mass mailing on the selected records the current search filter. -
- The following contacts will be mailed: - - and + Followers of the document and diff --git a/addons/mass_mailing_applicant/models/mass_mailing.py b/addons/mass_mailing_applicant/models/mass_mailing.py index b572cb566e3..ba645b719b7 100644 --- a/addons/mass_mailing_applicant/models/mass_mailing.py +++ b/addons/mass_mailing_applicant/models/mass_mailing.py @@ -13,12 +13,6 @@ class MassMailing(osv.Model): res.append(('hr.applicant', 'Applicants')) return res - def _get_model_to_list_action_id(self, cr, uid, model, context=None): - if model == 'hr.applicant': - return self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, 'mass_mailing_applicant.action_applicant_to_mailing_list') - else: - return super(MassMailing, self)._get_model_to_list_action_id(cr, uid, model, context=context) - def get_recipients_data(self, cr, uid, mailing, res_ids, context=None): if mailing.mailing_model == 'hr.applicant': res = {} diff --git a/addons/mass_mailing_crm/models/mass_mailing.py b/addons/mass_mailing_crm/models/mass_mailing.py index c39f275892d..3f1bb7d7a92 100644 --- a/addons/mass_mailing_crm/models/mass_mailing.py +++ b/addons/mass_mailing_crm/models/mass_mailing.py @@ -13,12 +13,6 @@ class MassMailing(osv.Model): res.append(('crm.lead', 'Leads / Opportunities')) return res - def _get_model_to_list_action_id(self, cr, uid, model, context=None): - if model == 'crm.lead': - return self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, 'mass_mailing_crm.action_lead_to_mailing_list') - else: - return super(MassMailing, self)._get_model_to_list_action_id(cr, uid, model, context=context) - def get_recipients_data(self, cr, uid, mailing, res_ids, context=None): if mailing.mailing_model == 'crm.lead': res = {}