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.

20 lines
754 B

9 years ago
9 years ago
9 years ago
  1. from openerp import api, models, fields
  2. class mail_message(models.Model):
  3. _inherit = 'mail.message'
  4. @api.one
  5. @api.depends('author_id', 'notified_partner_ids')
  6. def _get_sent(self):
  7. self.sent = len(self.notified_partner_ids) > 1 or len(self.notified_partner_ids) == 1 and self.author_id and self.notified_partner_ids[0].id != self.author_id.id
  8. sent = fields.Boolean('Sent', compute=_get_sent, help='Was message sent to someone', store=True)
  9. class mail_notification(models.Model):
  10. _inherit = 'mail.notification'
  11. def _notify(self, cr, uid, message_id, **kwargs):
  12. super(mail_notification, self)._notify(cr, uid, message_id, **kwargs)
  13. self.pool['mail.message'].browse(cr, uid, message_id)._get_sent()