Browse Source

Merge remote-tracking branch 'origin/8.0' into 9.0

pull/2/head
Ivan Yelizariev 9 years ago
parent
commit
2e2d4ea155
  1. 2
      __openerp__.py
  2. 13
      models.py

2
__openerp__.py

@ -1,6 +1,6 @@
{
'name' : 'Sentbox',
'version' : '1.0.0',
'version' : '1.0.1',
'author' : 'IT-Projects LLC, Ivan Yelizariev',
'license': 'LGPL-3',
'category' : 'Social Network',

13
models.py

@ -1,4 +1,5 @@
from openerp import api, models, fields, SUPERUSER_ID
from openerp import api, models, fields
class mail_message(models.Model):
_inherit = 'mail.message'
@ -6,13 +7,21 @@ class mail_message(models.Model):
@api.one
@api.depends('author_id', 'notified_partner_ids')
def _get_sent(self):
self.sent = len(self.notified_partner_ids) > 1 or len(self.notified_partner_ids)==1 and self.notified_partner_ids[0].id != self.author_id.id
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
sent = fields.Boolean('Sent', compute=_get_sent, help='Was message sent to someone', store=True)
class mail_notification(models.Model):
_inherit = 'mail.notification'
def _notify(self, cr, uid, message_id, **kwargs):
super(mail_notification, self)._notify(cr, uid, message_id, **kwargs)
self.pool['mail.message'].browse(cr, uid, message_id)._get_sent()
class mail_compose_message(models.TransientModel):
_inherit = 'mail.compose.message'
sent = fields.Boolean('Sent', help='dummy field to fix inherit error')
Loading…
Cancel
Save