Browse Source

Fix lint errors

pull/183/head
x620 8 years ago
committed by Ivan Yelizariev
parent
commit
4a1cd26e97
  1. 3
      im_notif/__init__.py
  2. 13
      im_notif/__openerp__.py
  3. 17
      im_notif/im_notif_models.py
  4. 4
      im_notif/static/src/js/im_notif.js

3
im_notif/__init__.py

@ -1,4 +1,5 @@
import im_notif_models
# -*- coding: utf-8 -*-
from . import im_notif_models
def pre_uninstall(cr, registry): def pre_uninstall(cr, registry):

13
im_notif/__openerp__.py

@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
{ {
'name' : 'IM Notifications',
'name': 'IM Notifications',
'version': '1.0.1', 'version': '1.0.1',
'author' : 'IT-Projects LLC, Ivan Yelizariev',
'author': 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3', 'license': 'GPL-3',
'category' : 'Tools',
'website' : 'https://twitter.com/yelizariev',
'category': 'Tools',
'website': 'https://twitter.com/yelizariev',
'price': 9.00, 'price': 9.00,
'currency': 'EUR', 'currency': 'EUR',
'depends' : ['im_chat', 'mail'],
'depends': ['im_chat', 'mail'],
'images': ['images/my-pref.png'], 'images': ['images/my-pref.png'],
'data':[
'data': [
'im_notif_data.xml', 'im_notif_data.xml',
'im_notif_views.xml', 'im_notif_views.xml',
], ],

17
im_notif/im_notif_models.py

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

4
im_notif/static/src/js/im_notif.js

@ -40,5 +40,5 @@
txt += _.escape(str.slice(last, str.length)); txt += _.escape(str.slice(last, str.length));
return txt; return txt;
}, },
})
})()
});
})();
Loading…
Cancel
Save