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.

19 lines
561 B

  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, api
  3. class ResPartner(models.Model):
  4. _inherit = 'res.partner'
  5. mails_to = fields.Integer(compute="_mails_to")
  6. mails_from = fields.Integer(compute="_mails_from")
  7. @api.one
  8. def _mails_to(self):
  9. for r in self:
  10. r.mails_to = self.env['mail.message'].sudo().search_count([('partner_ids', 'in', r.id)])
  11. @api.one
  12. def _mails_from(self):
  13. for r in self:
  14. r.mails_from = self.env['mail.message'].sudo().search_count([('author_id', '=', r.id)])