[REM] mail: compose message: removed unnecessary code
authorThibault Delavallée <tde@openerp.com>
Tue, 15 Apr 2014 14:33:43 +0000 (16:33 +0200)
committerThibault Delavallée <tde@openerp.com>
Tue, 15 Apr 2014 14:33:43 +0000 (16:33 +0200)
bzr revid: tde@openerp.com-20140415143343-on2d3j92o6zifq59

addons/email_template/wizard/mail_compose_message.py
addons/mail/wizard/mail_compose_message.py
addons/mail/wizard/mail_compose_message_view.xml
addons/mass_mailing_applicant/models/mass_mailing.py
addons/mass_mailing_crm/models/mass_mailing.py

index 61a7a70..00858e6 100644 (file)
@@ -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),
     }
index 74f8d2f..52bdbf8 100644 (file)
@@ -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
index 4bab178..5b6bfc5 100644 (file)
                                 <strong>Email mass mailing</strong> on
                                 <span attrs="{'invisible': [('use_active_domain', '=', True)]}">the selected records</span>
                                 <span attrs="{'invisible': [('use_active_domain', '=', False)]}">the current search filter</span>.
-                                <br />
-                                <span>The following contacts will be mailed: </span>
                             </span>
-                            <field name="recipients_data" class="oe_inline oe_compose_recipients" readonly="1" attrs="{'invisible':[('recipients_data', '=', False)]}"/>
-                            <span attrs="{'invisible':['|', ('composition_mode', '!=', 'comment'), ('recipients_data', '=', False)]}">and</span>
+                            <span attrs="{'invisible':[('composition_mode', '!=', 'comment')]}">Followers of the document and</span>
                             <field name="partner_ids" widget="many2many_tags_email" placeholder="Add contacts to notify..."
                                 context="{'force_email':True, 'show_email':True}"
                                 attrs="{'invisible': [('composition_mode', '!=', 'comment')]}"/>
index b572cb5..ba645b7 100644 (file)
@@ -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 = {}
index c39f275..3f1bb7d 100644 (file)
@@ -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 = {}