From 4a1cd26e97468490c8114cadaf39569bc24a7178 Mon Sep 17 00:00:00 2001 From: x620 Date: Mon, 15 Aug 2016 19:18:39 +0500 Subject: [PATCH] Fix lint errors --- im_notif/__init__.py | 3 ++- im_notif/__openerp__.py | 15 ++++++++------- im_notif/im_notif_data.xml | 2 +- im_notif/im_notif_models.py | 25 +++++++++++++------------ im_notif/im_notif_views.xml | 2 +- im_notif/static/src/js/im_notif.js | 4 ++-- 6 files changed, 27 insertions(+), 24 deletions(-) diff --git a/im_notif/__init__.py b/im_notif/__init__.py index 38fa180..e8cfb16 100644 --- a/im_notif/__init__.py +++ b/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): diff --git a/im_notif/__openerp__.py b/im_notif/__openerp__.py index 6e481d6..a4c3c5e 100644 --- a/im_notif/__openerp__.py +++ b/im_notif/__openerp__.py @@ -1,18 +1,19 @@ +# -*- coding: utf-8 -*- { - 'name' : 'IM Notifications', + 'name': 'IM Notifications', 'version': '1.0.1', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', - 'category' : 'Tools', - 'website' : 'https://twitter.com/yelizariev', + 'category': 'Tools', + 'website': 'https://twitter.com/yelizariev', 'price': 9.00, 'currency': 'EUR', - 'depends' : ['im_chat', 'mail'], + 'depends': ['im_chat', 'mail'], 'images': ['images/my-pref.png'], - 'data':[ + 'data': [ 'im_notif_data.xml', 'im_notif_views.xml', - ], + ], 'installable': True, 'uninstall_hook': 'pre_uninstall', } diff --git a/im_notif/im_notif_data.xml b/im_notif/im_notif_data.xml index 0d2f6b8..fb8a164 100644 --- a/im_notif/im_notif_data.xml +++ b/im_notif/im_notif_data.xml @@ -15,5 +15,5 @@ - + diff --git a/im_notif/im_notif_models.py b/im_notif/im_notif_models.py index 840f14f..58d06c1 100644 --- a/im_notif/im_notif_models.py +++ b/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.tools import html2plaintext from openerp.tools.translate import _ + class res_partner(models.Model): _inherit = 'res.partner' _columns = { @@ -13,12 +15,13 @@ class res_partner(models.Model): ('im_xor_email', 'IM (if online) + email (if offline)'), ('im_and_email', 'IM (if online) + email'), ('always', 'Only emails'), - ], 'Receive Inbox Notifications by Email, IM', required=True, + ], 'Receive Inbox Notifications by Email, IM', required=True, oldname='notification_email_send', help="Policy to receive emails, IM for new messages pushed to your personal Inbox. IM can be used only for partners with odoo user account" - ), + ), } + 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,26 +82,25 @@ 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'), - }.get(message.type, '') + }.get(message.type, '') about = message.subject or message.record_name or 'UNDEFINED' about = '[ABOUT] %s' % about if url: - about = '%s' % (url, about) + about = '%s' % (url, about) im_text = [ '_____________________', '_____[open_inbox]_____' % inbox_url, '%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) diff --git a/im_notif/im_notif_views.xml b/im_notif/im_notif_views.xml index ac90b0a..38ee97f 100644 --- a/im_notif/im_notif_views.xml +++ b/im_notif/im_notif_views.xml @@ -8,5 +8,5 @@ - + diff --git a/im_notif/static/src/js/im_notif.js b/im_notif/static/src/js/im_notif.js index 7994ca3..cf9eaff 100644 --- a/im_notif/static/src/js/im_notif.js +++ b/im_notif/static/src/js/im_notif.js @@ -40,5 +40,5 @@ txt += _.escape(str.slice(last, str.length)); return txt; }, - }) - })() \ No newline at end of file + }); + })(); \ No newline at end of file