'Return the recipients of a mailing campaign. This is based on the statistics
build for each mailing.'

def get_recipients(self, model=None):

    res = dict.fromkeys(self.ids, {})
    for campaign in self:
        domain = [('mass_mailing_campaign_id', '=', campaign.id)]
        if model:
            domain += [('model', '=', model)]
        res[campaign.id] = set(self.env['mail.mail.statistics'].search(domain).mapped('res_id'))
    return res
