Search code examples
odooodoo-8openerp-8

How can I see the emails address from marketing campaigns in Odoo?


I have sent some emailing campaigns form Marketing, at "Mass Mailings" at details I have "Emails" button. When I click on it I have columns "Mail ID (tech)", "Message-ID", "Sent" and others. But I do cannot see the email to which I have sent.

How can I see the email, which I think is the most important information, because I cannot see which client has opened the email?


Solution

  • @Ek Kosmos, You need to add some code to do so. Please apply following code to your repository.

    addons/mass_mailing/models/mass_mailing_stats.py

     def _compute_recipient(self, cr, uid, ids, field_names, arg, context=None):
            res = dict.fromkeys(ids, '')
            for stat in self.browse(cr, uid, ids, context=context):
                if not self.pool.get(stat.model):
                    continue
                target = self.pool[stat.model].browse(cr, uid, stat.res_id, context=context)
                email = ''
                for email_field in ('email', 'email_from'):
                    if email_field in target and target[email_field]:
                        email = ' <%s>' % target[email_field]
                        break
                res[stat.id] = '%s%s' % (target.display_name, email)
            return res
    

    in same file add into columns = {}

    'recipient': fields.function(_compute_recipient, string='Recipient', type='char'),
    

    then add into view

    addons/mass_mailing/views/mass_mailing.xml

    <field name="recipient"/>