Browse Source

During calculate mails count added sudo() and change search() -> search_count()

pull/3/head
x620 9 years ago
parent
commit
e91db8d440
  1. 6
      res_partner_mails_count/models.py

6
res_partner_mails_count/models.py

@ -28,11 +28,9 @@ class res_partner(models.Model):
@api.one
def _mails_from(self):
for r in self:
letters = self.env['mail.message'].search([('partner_ids', 'in', r.id)])
self.mails_from = len(letters)
self.mails_from = self.env['mail.message'].sudo().search_count([('partner_ids', 'in', r.id)])
@api.one
def _mails_to(self):
for r in self:
letters = self.env['mail.message'].search([('author_id', '=', r.id)])
self.mails_to = len(letters)
self.mails_to = self.env['mail.message'].sudo().search_count([('author_id', '=', r.id)])
Loading…
Cancel
Save