Calculate emails and partners to render

This commit is contained in:
Youssef Elouahby 2018-11-15 03:56:28 +01:00
parent 114b6bda5d
commit 084d8d2dd3

View File

@ -32,7 +32,8 @@ class GolemMailPresendWizard(models.TransientModel):
""" Call mail_compose_message wizard """
self.ensure_one()
wizard = self[0]
emails = wizard.recipient_ids.mapped('email')
emails = wizard.recipient_ids.filtered(lambda r: not r.partner_id).mapped('email')
partners = wizard.recipient_ids.filtered(lambda r: not r.opt_out).mapped('partner_id').ids
return {
'name' : _('Search results'),
'type' : 'ir.actions.act_window',
@ -42,7 +43,10 @@ class GolemMailPresendWizard(models.TransientModel):
'default_partner_to': "\\",
'default_use_template': True,
'default_template_id': self.env.ref('mail.email_template_partner').id,
'default_no_auto_thread': False},
'default_no_auto_thread': False,
'default_from_presend_wizard': True,
'partners_from_wizard': partners,
'emails_from_wizard': emails},
'view_mode': 'form',
'target': 'new'
}