You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
902 B

  1. from openerp import api,models,fields
  2. class MailMailStats(models.Model):
  3. _inherit = 'mail.mail.statistics'
  4. partner_ids = fields.Many2many('res.partner', related='mail_mail_id.recipient_ids', string='Partners (Mail)')
  5. @api.one
  6. def _get_partner_id(self):
  7. if self.model=='res.partner':
  8. self.partner_id = self.res_id
  9. else:
  10. self.partner_id = None
  11. partner_id = fields.Many2one('res.partner', compute=_get_partner_id, string='Partner (Document ID)')
  12. @api.one
  13. def _get_partners(self):
  14. res = {}
  15. for p in self.partner_ids:
  16. res[p.id] = p
  17. if self.partner_id and self.partner_id.id not in res:
  18. res[self.partner_id.id] = self.partner_id
  19. self.partners = ', '.join([('%s <%s>' % (p.name, p.email)) for id,p in res.items()])
  20. partners = fields.Char('Partners', compute=_get_partners)