|
|
@ -1,9 +1,11 @@ |
|
|
|
import openerp |
|
|
|
from openerp import api, models, fields, SUPERUSER_ID, tools |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
from openerp import SUPERUSER_ID |
|
|
|
from openerp import models |
|
|
|
from openerp import tools |
|
|
|
from openerp.osv import fields as old_fields |
|
|
|
from openerp.tools import html2plaintext |
|
|
|
from openerp.tools.translate import _ |
|
|
|
|
|
|
|
|
|
|
|
class res_partner(models.Model): |
|
|
|
_inherit = 'res.partner' |
|
|
|
_columns = { |
|
|
@ -19,6 +21,7 @@ class res_partner(models.Model): |
|
|
|
), |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class mail_notification(models.Model): |
|
|
|
_inherit = 'mail.notification' |
|
|
|
|
|
|
@ -51,7 +54,7 @@ class mail_notification(models.Model): |
|
|
|
continue |
|
|
|
send_email = False |
|
|
|
for user in partner.user_ids: |
|
|
|
if user.im_status=='offline': |
|
|
|
if user.im_status == 'offline': |
|
|
|
if n != 'im': |
|
|
|
send_email = True |
|
|
|
else: |
|
|
@ -79,7 +82,7 @@ class mail_notification(models.Model): |
|
|
|
) |
|
|
|
author = message.author_id and message.author_id.name_get() |
|
|
|
author = author and author[0][1] or message.email_from |
|
|
|
#body = html2plaintext(message.body)[:100] or '' |
|
|
|
# body = html2plaintext(message.body)[:100] or '' |
|
|
|
mtype = {'email': _('Email'), |
|
|
|
'comment': _('Comment'), |
|
|
|
'notification': _('System notification'), |
|
|
@ -95,10 +98,9 @@ class mail_notification(models.Model): |
|
|
|
'%s [FROM] %s' % (message.type, author), |
|
|
|
about, |
|
|
|
] |
|
|
|
#im_text = im_text + body.split('\n') |
|
|
|
# im_text = im_text + body.split('\n') |
|
|
|
return im_text |
|
|
|
|
|
|
|
|
|
|
|
def _notify_email(self, cr, uid, ids, message_id, force_send=False, user_signature=True, context=None): |
|
|
|
# based on addons/mail/mail_followers.py::_notify_email |
|
|
|
message = self.pool['mail.message'].browse(cr, SUPERUSER_ID, message_id, context=context) |
|
|
@ -128,7 +130,6 @@ class mail_notification(models.Model): |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
def _do_notify_email(self, cr, uid, email_pids, message, force_send=False, user_signature=True, context=None): |
|
|
|
|
|
|
|
# compute email body (signature, company data) |
|
|
|