5

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?

radu c
  • 4,138
  • 7
  • 30
  • 45

1 Answers1

5

@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"/>
ChesuCR
  • 9,352
  • 5
  • 51
  • 114
Bazzinga...
  • 996
  • 2
  • 16
  • 26
  • Is ok if I modify directly in the module? – radu c Sep 28 '15 at 06:58
  • I mean that's your choice, If you want to create a new module then you need to inherit a model and put the above field and method into it, and inherit tree and form view and apply the above field in it. That's not a big deal. is it.? – Bazzinga... Sep 28 '15 at 07:02
  • For me is because I have not worked in py. Can you please explain me where exactly I need to insert `` in `mass_mailing.xml` because there are many tags there. – radu c Sep 28 '15 at 07:09
  • You have to add a into following record tag and – Bazzinga... Sep 28 '15 at 07:18
  • Now I have the following error : `File "/usr/lib/python2.7/dist-packages/openerp/addons/mass_mailing/models/mass_mailing_stats.py", line 67, in MailMailStats 'recipient': fields.function(_compute_recipient, string='Recipient', type='char'), NameError: name '_compute_recipient' is not defined` – radu c Sep 28 '15 at 08:18
  • Did you inherit the model.? Can you share the file.? You have to write method before the field declaration. – Bazzinga... Sep 28 '15 at 08:39
  • Ok, no errors now but where I should see the email? – radu c Sep 28 '15 at 11:52
  • Go to the form view of mass_mailing campaign and then click on sent or any state button you will see in a list view. If it resolved please accept as answer. thanks.! – Bazzinga... Sep 28 '15 at 12:10
  • okay can you share me your views/mass_mailing.xml . I think you missed to add into form view. You have to add into two places one is tree view and another is form view. – Bazzinga... Sep 28 '15 at 13:21
  • Please copy this. http://pastebin.com/j6RkSfpS . You didnt add any field. Please Check my previous comments atleast I explained there. – Bazzinga... Sep 28 '15 at 13:44
  • Yes, I have added but at the end after the last field tag : ` ` as you have not specified. – radu c Sep 28 '15 at 14:04