From d412fa4dd769230c9631551ed2b1dbd084bfa278 Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Fri, 19 Aug 2016 20:12:06 +0500 Subject: [PATCH] [REF] fix lint errors (9.0) --- mail_all/__init__.py | 2 +- mail_all/tests/__init__.py | 2 +- mail_all/tests/test_js.py | 2 ++ mail_archives/tests/__init__.py | 2 +- mail_archives/tests/test_js.py | 2 ++ mail_check_immediately/__openerp__.py | 12 +++---- mail_delete_odoo_footer/__openerp__.py | 14 ++++----- mail_fix_553/__openerp__.py | 10 +++--- mail_fix_553/mail_fix_553.py | 18 +++++------ mail_fix_empty_body/__openerp__.py | 14 ++++----- mail_fix_empty_body/models.py | 1 + mail_fix_header_from/__openerp__.py | 10 +++--- mail_move_message/__openerp__.py | 16 +++++----- mail_move_message/controllers/__init__.py | 2 +- mail_move_message/controllers/main.py | 4 +-- mail_move_message/mail_move_message_models.py | 31 ++++++++++--------- mail_outgoing/__openerp__.py | 14 ++++----- mail_outgoing/mail_outgoing_models.py | 4 ++- mail_partner_lang/__openerp__.py | 12 +++---- mail_partner_lang/models.py | 11 ++++--- mail_recovery/__openerp__.py | 2 +- mail_sent/models.py | 6 ++-- mail_sent/tests/__init__.py | 2 +- mail_sent/tests/test_js.py | 2 ++ mailgun/models.py | 1 + mass_mailing_extra/__openerp__.py | 14 ++++----- mass_mailing_extra/models.py | 8 ++--- res_partner_mails_count/__init__.py | 2 +- res_partner_mails_count/tests/test_mail.py | 3 +- res_partner_mails_count/tests/test_phantom.py | 4 ++- 30 files changed, 121 insertions(+), 106 deletions(-) diff --git a/mail_all/__init__.py b/mail_all/__init__.py index 5305644..cde864b 100644 --- a/mail_all/__init__.py +++ b/mail_all/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -from . import models \ No newline at end of file +from . import models diff --git a/mail_all/tests/__init__.py b/mail_all/tests/__init__.py index 6731bb9..11b0967 100644 --- a/mail_all/tests/__init__.py +++ b/mail_all/tests/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -import test_js \ No newline at end of file +import test_js diff --git a/mail_all/tests/test_js.py b/mail_all/tests/test_js.py index 5c62a58..993913d 100644 --- a/mail_all/tests/test_js.py +++ b/mail_all/tests/test_js.py @@ -1,8 +1,10 @@ import openerp.tests + @openerp.tests.common.at_install(False) @openerp.tests.common.post_install(True) class TestUi(openerp.tests.HttpCase): + def test_01_mail_all(self): # wait till page loaded and then click and wait again code = """ diff --git a/mail_archives/tests/__init__.py b/mail_archives/tests/__init__.py index 6731bb9..11b0967 100644 --- a/mail_archives/tests/__init__.py +++ b/mail_archives/tests/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -import test_js \ No newline at end of file +import test_js diff --git a/mail_archives/tests/test_js.py b/mail_archives/tests/test_js.py index 709cc28..46f9b3a 100644 --- a/mail_archives/tests/test_js.py +++ b/mail_archives/tests/test_js.py @@ -1,8 +1,10 @@ import openerp.tests + @openerp.tests.common.at_install(False) @openerp.tests.common.post_install(True) class TestUi(openerp.tests.HttpCase): + def test_01_mail_archives(self): # wait till page loaded and then click and wait again code = """ diff --git a/mail_check_immediately/__openerp__.py b/mail_check_immediately/__openerp__.py index f122bdf..dcc2797 100644 --- a/mail_check_immediately/__openerp__.py +++ b/mail_check_immediately/__openerp__.py @@ -1,16 +1,16 @@ { - 'name' : 'Check mail immediately', - 'version' : '1.0.1', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Check mail immediately', + 'version': '1.0.1', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'LGPL-3', "category": "Discuss", - 'website' : 'https://twitter.com/yelizariev', + 'website': 'https://twitter.com/yelizariev', 'price': 9.00, 'currency': 'EUR', - 'depends' : ['base', 'web', 'fetchmail', 'mail'], + 'depends': ['base', 'web', 'fetchmail', 'mail'], 'data': [ 'views.xml', - ], + ], 'qweb': [ "static/src/xml/main.xml", ], diff --git a/mail_delete_odoo_footer/__openerp__.py b/mail_delete_odoo_footer/__openerp__.py index f370f0c..9b7547f 100644 --- a/mail_delete_odoo_footer/__openerp__.py +++ b/mail_delete_odoo_footer/__openerp__.py @@ -1,12 +1,12 @@ { - 'name' : 'Delete Odoo footer in email (TODO)', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Delete Odoo footer in email (TODO)', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'LGPL-3', "category": "Discuss", - 'website' : 'https://yelizariev.github.io', - 'depends' : [], - 'data':[ - ], + 'website': 'https://yelizariev.github.io', + 'depends': [], + 'data': [ + ], 'installable': False } diff --git a/mail_fix_553/__openerp__.py b/mail_fix_553/__openerp__.py index 8bc85e1..91b450d 100644 --- a/mail_fix_553/__openerp__.py +++ b/mail_fix_553/__openerp__.py @@ -1,11 +1,11 @@ { - "name" : "Fix mail error 553", - "version" : "0.3", - "author" : "IT-Projects LLC, Ivan Yelizariev", + "name": "Fix mail error 553", + "version": "0.3", + "author": "IT-Projects LLC, Ivan Yelizariev", 'license': 'LGPL-3', "category": "Discuss", - "website" : "https://yelizariev.github.io", - "depends" : ["base", "mail"], + "website": "https://yelizariev.github.io", + "depends": ["base", "mail"], "data": ["data.xml"], 'installable': False } diff --git a/mail_fix_553/mail_fix_553.py b/mail_fix_553/mail_fix_553.py index 70af917..d6feb19 100644 --- a/mail_fix_553/mail_fix_553.py +++ b/mail_fix_553/mail_fix_553.py @@ -16,6 +16,7 @@ _logger = logging.getLogger(__name__) import re + class mail_mail(osv.Model): _inherit = "mail.mail" @@ -41,10 +42,9 @@ class mail_mail(osv.Model): catchall_alias_name = self.pool['ir.config_parameter'].get_param(cr, uid, "mail.catchall.name_alias_from", context=context) catchall_domain = self.pool['ir.config_parameter'].get_param(cr, uid, "mail.catchall.domain", context=context) - correct_email_from = '@%s>?\s*$'%catchall_domain + correct_email_from = '@%s>?\s*$' % catchall_domain default_email_from = '%s@%s' % (catchall_alias, catchall_domain) - context = dict(context or {}) ir_mail_server = self.pool.get('ir.mail_server') ir_attachment = self.pool['ir.attachment'] @@ -64,8 +64,8 @@ class mail_mail(osv.Model): # soft/hard mem limits with temporary data. attachment_ids = [a.id for a in mail.attachment_ids] attachments = [(a['datas_fname'], base64.b64decode(a['datas'])) - for a in ir_attachment.read(cr, SUPERUSER_ID, attachment_ids, - ['datas_fname', 'datas'])] + for a in ir_attachment.read(cr, SUPERUSER_ID, attachment_ids, + ['datas_fname', 'datas'])] # specific behavior to customize the send email for notified partners email_list = [] @@ -106,7 +106,7 @@ class mail_mail(osv.Model): email_from = formataddr((catchall_alias_name, email_from)) msg = ir_mail_server.build_email( - email_from=email_from, # NEW STUFF + email_from=email_from, # NEW STUFF email_to=email.get('email_to'), subject=email.get('subject'), body=email.get('body'), @@ -122,8 +122,8 @@ class mail_mail(osv.Model): headers=headers) try: res = ir_mail_server.send_email(cr, uid, msg, - mail_server_id=mail.mail_server_id.id, - context=context) + mail_server_id=mail.mail_server_id.id, + context=context) except AssertionError as error: if error.message == ir_mail_server.NO_VALID_RECIPIENT: # No valid recipient found for this particular @@ -146,8 +146,8 @@ class mail_mail(osv.Model): except MemoryError: # prevent catching transient MemoryErrors, bubble up to notify user or abort cron job # instead of marking the mail as failed - _logger.exception('MemoryError while processing mail with ID %r and Msg-Id %r. '\ - 'Consider raising the --limit-memory-hard startup option', + _logger.exception('MemoryError while processing mail with ID %r and Msg-Id %r. ' + 'Consider raising the --limit-memory-hard startup option', mail.id, mail.message_id) raise except Exception as e: diff --git a/mail_fix_empty_body/__openerp__.py b/mail_fix_empty_body/__openerp__.py index 2ab7b51..9228b2c 100644 --- a/mail_fix_empty_body/__openerp__.py +++ b/mail_fix_empty_body/__openerp__.py @@ -1,14 +1,14 @@ { - 'name' : 'Fix "False" in empty email body', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Fix "False" in empty email body', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'LGPL-3', "category": "Discuss", - 'website' : 'https://twitter.com/yelizariev', + 'website': 'https://twitter.com/yelizariev', 'price': 9.00, 'currency': 'EUR', - 'depends' : ['mail'], - 'data':[ - ], + 'depends': ['mail'], + 'data': [ + ], 'installable': False } diff --git a/mail_fix_empty_body/models.py b/mail_fix_empty_body/models.py index 0d45e2d..93de6d8 100644 --- a/mail_fix_empty_body/models.py +++ b/mail_fix_empty_body/models.py @@ -1,5 +1,6 @@ from openerp import api, models, fields, SUPERUSER_ID + class mail_compose_message(models.TransientModel): _inherit = 'mail.compose.message' diff --git a/mail_fix_header_from/__openerp__.py b/mail_fix_header_from/__openerp__.py index 3e4cea6..5943613 100644 --- a/mail_fix_header_from/__openerp__.py +++ b/mail_fix_header_from/__openerp__.py @@ -1,14 +1,14 @@ { - "name" : "Fix non-ascii header 'from' (OBSOLETE)", - "version" : "0.3", - "author" : "IT-Projects LLC, Ivan Yelizariev", + "name": "Fix non-ascii header 'from' (OBSOLETE)", + "version": "0.3", + "author": "IT-Projects LLC, Ivan Yelizariev", 'license': 'LGPL-3', "category": "Discuss", - "website" : "https://yelizariev.github.io", + "website": "https://yelizariev.github.io", "description": """ Obsolete in odoo 8.0 since Sep 10, 2014 https://github.com/odoo/odoo/commit/f2cf6ced17d3477b8858e3a8f955a42cc8a629ff . You can install this module, if you use older version. """, - "depends" : ["base"], + "depends": ["base"], #"init_xml" : [], #"update_xml" : [], #"active": True, diff --git a/mail_move_message/__openerp__.py b/mail_move_message/__openerp__.py index b7647d7..9bde151 100644 --- a/mail_move_message/__openerp__.py +++ b/mail_move_message/__openerp__.py @@ -1,18 +1,18 @@ { - 'name' : 'Mail relocation', - 'version' : '1.0.4', - 'author' : 'IT-Projects LLC, Ivan Yelizariev, Pavel Romanchenko', + 'name': 'Mail relocation', + 'version': '1.0.4', + 'author': 'IT-Projects LLC, Ivan Yelizariev, Pavel Romanchenko', 'license': 'LGPL-3', - 'category' : 'Discuss', - 'website' : 'https://twitter.com/yelizariev', + 'category': 'Discuss', + 'website': 'https://twitter.com/yelizariev', 'price': 100.00, 'currency': 'EUR', - 'depends' : ['mail_all', 'web_polymorphic_field'], + 'depends': ['mail_all', 'web_polymorphic_field'], 'images': ['images/inbox.png'], - 'data':[ + 'data': [ 'mail_move_message_views.xml', 'data/mail_move_message_data.xml', - ], + ], 'qweb': [ 'static/src/xml/mail_move_message_main.xml', ], diff --git a/mail_move_message/controllers/__init__.py b/mail_move_message/controllers/__init__.py index 039d971..8ee9bae 100644 --- a/mail_move_message/controllers/__init__.py +++ b/mail_move_message/controllers/__init__.py @@ -1 +1 @@ -import main \ No newline at end of file +import main diff --git a/mail_move_message/controllers/main.py b/mail_move_message/controllers/main.py index 531b397..e859165 100644 --- a/mail_move_message/controllers/main.py +++ b/mail_move_message/controllers/main.py @@ -9,6 +9,7 @@ class MailChatController(openerp.addons.bus.controllers.main.BusController): # ----------------------------- # Extends BUS Controller Poll # ----------------------------- + def _poll(self, dbname, channels, last, options): if request.session.uid: registry, cr, uid, context = request.registry, request.cr, request.session.uid, request.context @@ -40,12 +41,11 @@ class DataSetCustom(DataSet): res.append((r[0], _('%s ID %s') % (r[1], r[0]))) return res - @http.route('/web/dataset/call_kw//name_search', type='json', auth="user") def name_search(self, model, method, args, kwargs): context = kwargs.get('context') if context and context.get('extended_name_with_contact'): - #add order by ID desc + # add order by ID desc cr, uid = request.cr, request.uid Model = request.registry[model] search_args = list(kwargs.get('args') or []) diff --git a/mail_move_message/mail_move_message_models.py b/mail_move_message/mail_move_message_models.py index 4017707..51f940f 100644 --- a/mail_move_message/mail_move_message_models.py +++ b/mail_move_message/mail_move_message_models.py @@ -3,6 +3,7 @@ from openerp import api, models, fields, SUPERUSER_ID from openerp.tools import email_split from openerp.tools.translate import _ + class wizard(models.TransientModel): _name = 'mail_move_message.wizard' @@ -34,7 +35,7 @@ class wizard(models.TransientModel): if 'message_id' in res: message = self.env['mail.message'].browse(res['message_id']) email_from = message.email_from - parts = email_split(email_from.replace(' ',',')) + parts = email_split(email_from.replace(' ', ',')) if parts: email = parts[0] name = email_from.find(email) != -1 and email_from[:email_from.index(email)].replace('"', '').replace('<', '').strip() or email_from @@ -51,7 +52,7 @@ class wizard(models.TransientModel): res['res_id'] = res_id and res_id[0].id config_parameters = self.env['ir.config_parameter'] - res['move_followers'] = config_parameters.get_param('mail_relocation_move_followers') + res['move_followers'] = config_parameters.get_param('mail_relocation_move_followers') res['uid'] = self.env.uid @@ -102,8 +103,8 @@ class wizard(models.TransientModel): def update_move_back(self): model = self.message_id.moved_from_model self.move_back = self.parent_id == self.message_id.moved_from_parent_id \ - and self.res_id == self.message_id.moved_from_res_id \ - and (self.model == model or (not self.model and not model)) + and self.res_id == self.message_id.moved_from_res_id \ + and (self.model == model or (not self.model and not model)) @api.onchange('parent_id') def on_change_parent_id(self): @@ -140,7 +141,7 @@ class wizard(models.TransientModel): operation = 'write' context = self._context - if not ( self.model and self.res_id ): + if not (self.model and self.res_id): return True model_obj = self.pool[self.model] mids = model_obj.exists(cr, uid, [self.res_id]) @@ -169,9 +170,9 @@ class wizard(models.TransientModel): for r in self: r.check_access() if not r.parent_id or not (r.parent_id.model == r.model and - r.parent_id.res_id == r.res_id): - #link with the first message of record - parent = self.env['mail.message'].search([('model','=',r.model), ('res_id','=',r.res_id)], order='id', limit=1) + r.parent_id.res_id == r.res_id): + # link with the first message of record + parent = self.env['mail.message'].search([('model', '=', r.model), ('res_id', '=', r.res_id)], order='id', limit=1) r.parent_id = parent.id or None r.message_id.move(r.parent_id.id, r.res_id, r.model, r.move_back, r.move_followers) @@ -265,7 +266,7 @@ class mail_message(models.Model): fol_obj = self.env['mail.followers'] for message in self: followers = fol_obj.sudo().search([('res_model', '=', message.model), - ('res_id', '=', message.res_id)]) + ('res_id', '=', message.res_id)]) for f in followers: self.env[model].browse(ids).message_subscribe([f.partner_id.id], [s.id for s in f.subtype_ids]) @@ -333,7 +334,7 @@ class mail_message(models.Model): return [] if isinstance(ids, (long, int)): ids = [ids] - reads = self.read(cr, uid, ids, ['record_name','model', 'res_id'], context=context) + reads = self.read(cr, uid, ids, ['record_name', 'model', 'res_id'], context=context) res = [] for record in reads: name = record['record_name'] or '' @@ -400,11 +401,11 @@ class res_partner(models.Model): email_address = (vals['email'].replace('\\', '\\\\').replace('%', '\\%').replace('_', '\\_')) email_brackets = "<%s>" % email_address messages = mail_message_obj.search([ - '|', - ('email_from', '=ilike', email_address), - ('email_from', 'ilike', email_brackets), - ('author_id', '=', False) - ]) + '|', + ('email_from', '=ilike', email_address), + ('email_from', 'ilike', email_brackets), + ('author_id', '=', False) + ]) if messages: messages.sudo().write({'author_id': res.id}) return res diff --git a/mail_outgoing/__openerp__.py b/mail_outgoing/__openerp__.py index 67b1cf9..7564efa 100644 --- a/mail_outgoing/__openerp__.py +++ b/mail_outgoing/__openerp__.py @@ -1,20 +1,20 @@ { - 'name' : 'Outgoing mails menu', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Outgoing mails menu', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'LGPL-3', "category": "Discuss", - 'website' : 'https://yelizariev.github.io', + 'website': 'https://yelizariev.github.io', 'description': """ Allows to check outgoing mails, i.e. failed or delayed. Tested on Odoo 8.0 ab7b5d7732a7c222a0aea45bd173742acd47242d """, - 'depends' : ['mail'], - 'data':[ + 'depends': ['mail'], + 'data': [ 'security/mail_outgoing.xml', 'security/ir.model.access.csv', 'mail_outgoing_views.xml', - ], + ], 'installable': False } diff --git a/mail_outgoing/mail_outgoing_models.py b/mail_outgoing/mail_outgoing_models.py index a823bbc..2ba4cb4 100644 --- a/mail_outgoing/mail_outgoing_models.py +++ b/mail_outgoing/mail_outgoing_models.py @@ -1,5 +1,6 @@ from openerp.osv import osv + class mail_message(osv.Model): _inherit = 'mail.message' @@ -13,10 +14,11 @@ class mail_message(osv.Model): return super(mail_message, self).check_access_rule(cr, uid, ids, operation, context) + class mail_mail(osv.Model): _name = 'mail.mail' _inherit = ['mail.mail', 'ir.needaction_mixin'] _needaction = True def _needaction_domain_get(self, cr, uid, context=None): - return [('state','in', ['outgoing', 'exception'])] + return [('state', 'in', ['outgoing', 'exception'])] diff --git a/mail_partner_lang/__openerp__.py b/mail_partner_lang/__openerp__.py index 3546595..0cb2ab5 100644 --- a/mail_partner_lang/__openerp__.py +++ b/mail_partner_lang/__openerp__.py @@ -1,12 +1,12 @@ { - 'name' : 'Use partner language in mail', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Use partner language in mail', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'LGPL-3', "category": "Discuss", - 'website' : 'https://yelizariev.github.io', + 'website': 'https://yelizariev.github.io', - 'depends' : ['mail'], - 'data':[], + 'depends': ['mail'], + 'data': [], 'installable': False, } diff --git a/mail_partner_lang/models.py b/mail_partner_lang/models.py index 1836778..283316e 100644 --- a/mail_partner_lang/models.py +++ b/mail_partner_lang/models.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- -from openerp.osv import osv,fields +from openerp.osv import osv, fields from openerp import SUPERUSER_ID + class mail_thread(osv.Model): _inherit = "mail.thread" @@ -37,7 +38,7 @@ class mail_thread(osv.Model): for browse_record in self.browse(cr, uid, ids, context=context): p = getattr(browse_record, 'partner_id', None) if p: - browse_record._context.update({'lang':p.lang}) + browse_record._context.update({'lang': p.lang}) initial = initial_values[browse_record.id] changes = set() @@ -53,12 +54,12 @@ class mail_thread(osv.Model): if record_value == initial_value and getattr(self._all_columns[col_name].column, 'track_visibility', None) == 'always': tracked_values[col_name] = dict(col_info=col_info['string'], - new_value=convert_for_display(record_value, col_info)) + new_value=convert_for_display(record_value, col_info)) elif record_value != initial_value and (record_value or initial_value): # because browse null != False if getattr(self._all_columns[col_name].column, 'track_visibility', None) in ['always', 'onchange']: tracked_values[col_name] = dict(col_info=col_info['string'], - old_value=convert_for_display(initial_value, col_info), - new_value=convert_for_display(record_value, col_info)) + old_value=convert_for_display(initial_value, col_info), + new_value=convert_for_display(record_value, col_info)) if col_name in tracked_fields: changes.add(col_name) if not changes: diff --git a/mail_recovery/__openerp__.py b/mail_recovery/__openerp__.py index 383622e..167acc1 100644 --- a/mail_recovery/__openerp__.py +++ b/mail_recovery/__openerp__.py @@ -12,6 +12,6 @@ 'depends': ['mail'], 'data': [ 'data.xml', - ], + ], "installable": True, } diff --git a/mail_sent/models.py b/mail_sent/models.py index 99f4473..f8310be 100644 --- a/mail_sent/models.py +++ b/mail_sent/models.py @@ -12,9 +12,9 @@ class MailMessage(models.Model): def _get_sent(self): self_sudo = self.sudo() self_sudo.sent = len(self_sudo.partner_ids) > 1 \ - or len(self_sudo.partner_ids) == 1 \ - and self_sudo.author_id \ - and self_sudo.partner_ids[0].id != self_sudo.author_id.id + or len(self_sudo.partner_ids) == 1 \ + and self_sudo.author_id \ + and self_sudo.partner_ids[0].id != self_sudo.author_id.id @api.multi def message_format(self): diff --git a/mail_sent/tests/__init__.py b/mail_sent/tests/__init__.py index 6731bb9..11b0967 100644 --- a/mail_sent/tests/__init__.py +++ b/mail_sent/tests/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -import test_js \ No newline at end of file +import test_js diff --git a/mail_sent/tests/test_js.py b/mail_sent/tests/test_js.py index 952c7e2..11da659 100644 --- a/mail_sent/tests/test_js.py +++ b/mail_sent/tests/test_js.py @@ -1,8 +1,10 @@ import openerp.tests + @openerp.tests.common.at_install(False) @openerp.tests.common.post_install(True) class TestUi(openerp.tests.HttpCase): + def test_01_mail_sent(self): # wait till page loaded and then click and wait again code = """ diff --git a/mailgun/models.py b/mailgun/models.py index 4479799..1369982 100644 --- a/mailgun/models.py +++ b/mailgun/models.py @@ -12,6 +12,7 @@ from openerp.addons.mail.models.mail_thread import mail_header_msgid_re import logging _logger = logging.getLogger(__name__) + class MailThread(models.AbstractModel): _inherit = 'mail.thread' diff --git a/mass_mailing_extra/__openerp__.py b/mass_mailing_extra/__openerp__.py index 8434c1b..60f62ed 100644 --- a/mass_mailing_extra/__openerp__.py +++ b/mass_mailing_extra/__openerp__.py @@ -1,10 +1,10 @@ { - 'name' : 'Improvements for mass mailing', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Improvements for mass mailing', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'LGPL-3', "category": "Discuss", - 'website' : 'https://yelizariev.github.io', + 'website': 'https://yelizariev.github.io', 'description': """ Modules adds: @@ -13,9 +13,9 @@ Modules adds: Tested on 8.0 f8d5a6727d3e8d428d9bef93da7ba6b11f344284 """, - 'depends' : ['mass_mailing'], - 'data':[ + 'depends': ['mass_mailing'], + 'data': [ 'views.xml', - ], + ], 'installable': False } diff --git a/mass_mailing_extra/models.py b/mass_mailing_extra/models.py index 1fc804f..904043b 100644 --- a/mass_mailing_extra/models.py +++ b/mass_mailing_extra/models.py @@ -1,4 +1,5 @@ -from openerp import api,models,fields +from openerp import api, models, fields + class MailMailStats(models.Model): @@ -8,7 +9,7 @@ class MailMailStats(models.Model): @api.one def _get_partner_id(self): - if self.model=='res.partner': + if self.model == 'res.partner': self.partner_id = self.res_id else: self.partner_id = None @@ -22,7 +23,6 @@ class MailMailStats(models.Model): res[p.id] = p if self.partner_id and self.partner_id.id not in res: res[self.partner_id.id] = self.partner_id - self.partners = ', '.join([('%s <%s>' % (p.name, p.email)) for id,p in res.items()]) - + self.partners = ', '.join([('%s <%s>' % (p.name, p.email)) for id, p in res.items()]) partners = fields.Char('Partners', compute=_get_partners) diff --git a/res_partner_mails_count/__init__.py b/res_partner_mails_count/__init__.py index 0f7cb6b..89d26e2 100644 --- a/res_partner_mails_count/__init__.py +++ b/res_partner_mails_count/__init__.py @@ -1,2 +1,2 @@ # -*- coding: utf-8 -*- -import models \ No newline at end of file +import models diff --git a/res_partner_mails_count/tests/test_mail.py b/res_partner_mails_count/tests/test_mail.py index f606964..4fbcf97 100644 --- a/res_partner_mails_count/tests/test_mail.py +++ b/res_partner_mails_count/tests/test_mail.py @@ -5,6 +5,7 @@ from openerp.tests.common import TransactionCase class test_message_count(TransactionCase): post_install = True + def test_count(self): new_partner1 = self.env['res.partner'].sudo().create({'name': 'rpmc Test Partner one', 'email': 'tt@tt', 'notify_email': 'always'}) new_partner2 = self.env['res.partner'].sudo().create({'name': 'rpmc Test Partner two', 'email': 'rr@rr', 'notify_email': 'always'}) @@ -30,4 +31,4 @@ class test_message_count(TransactionCase): self.assertEqual(new_partner1.mails_to, 0) self.assertEqual(new_partner1.mails_from, 2, 'rpmc: one message but mails_from != 2') self.assertEqual(new_partner2.mails_to, 2, 'rpmc: one message but mails_to != 2') - self.assertEqual(new_partner2.mails_from, 0) \ No newline at end of file + self.assertEqual(new_partner2.mails_from, 0) diff --git a/res_partner_mails_count/tests/test_phantom.py b/res_partner_mails_count/tests/test_phantom.py index 4790eae..360c953 100644 --- a/res_partner_mails_count/tests/test_phantom.py +++ b/res_partner_mails_count/tests/test_phantom.py @@ -1,11 +1,13 @@ import openerp.tests + @openerp.tests.common.at_install(False) @openerp.tests.common.post_install(True) class TestUi(openerp.tests.HttpCase): + def test_01_res_partner_mails_to_count(self): # self.phantom_js('/', "openerp.Tour.run('mails_count_tour', 'test')", "openerp.Tour.tours.mails_count_tour", login="admin") - self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('mails_count_tour', 'test')","odoo.__DEBUG__.services['web.Tour'].tours.mails_count_tour", login="admin") + self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('mails_count_tour', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.mails_count_tour", login="admin") def test_02_res_partner_mails_from_count(self): # wait till page loaded and then click and wait again