From d78b15f2ead57d2ab5504587d456c25b046a6c46 Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Wed, 12 Feb 2020 08:54:08 +0000 Subject: [PATCH] :green_heart: pre-commit: auto cleanups --- .isort.cfg | 2 +- mail_base/controllers/main.py | 3 ++- mail_fix_553/mail_fix_553.py | 6 ++++-- mail_move_message/mail_move_message_models.py | 11 +++-------- mailgun/models/ir_config_parameter.py | 1 + 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.isort.cfg b/.isort.cfg index 249c22f..466932b 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -9,4 +9,4 @@ line_length=88 known_odoo=odoo known_odoo_addons=odoo.addons sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER -known_third_party=openerp,requests,simplejson +known_third_party=requests,simplejson diff --git a/mail_base/controllers/main.py b/mail_base/controllers/main.py index c00562f..d65a0ac 100644 --- a/mail_base/controllers/main.py +++ b/mail_base/controllers/main.py @@ -1,9 +1,10 @@ # Copyright 2017 mikaelh # Copyright 2017-2019 Ivan Yelizariev # License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html) -from odoo.addons.bus.controllers.main import BusController from odoo.http import request +from odoo.addons.bus.controllers.main import BusController + class MailChatController(BusController): # ----------------------------- diff --git a/mail_fix_553/mail_fix_553.py b/mail_fix_553/mail_fix_553.py index 665149c..890f29d 100644 --- a/mail_fix_553/mail_fix_553.py +++ b/mail_fix_553/mail_fix_553.py @@ -4,11 +4,12 @@ import re from email.utils import formataddr from odoo import SUPERUSER_ID, tools -from odoo.addons.base.ir.ir_mail_server import MailDeliveryException from odoo.osv import osv from odoo.tools.safe_eval import safe_eval as eval from odoo.tools.translate import _ +from odoo.addons.base.ir.ir_mail_server import MailDeliveryException + _logger = logging.getLogger(__name__) @@ -146,7 +147,8 @@ class MailMail(osv.Model): attachments=attachments, message_id=mail.message_id, references=mail.references, - object_id=mail.res_id and ("{}-{}".format(mail.res_id, mail.model)), + object_id=mail.res_id + and ("{}-{}".format(mail.res_id, mail.model)), subtype="html", subtype_alternative="plain", headers=headers, diff --git a/mail_move_message/mail_move_message_models.py b/mail_move_message/mail_move_message_models.py index 293c372..8129a81 100644 --- a/mail_move_message/mail_move_message_models.py +++ b/mail_move_message/mail_move_message_models.py @@ -428,9 +428,7 @@ class MailMessage(models.Model): # building message tree return if not self.author_id: - self.write( - {"author_id": author.id} - ) + self.write({"author_id": author.id}) vals = {} if move_back: @@ -462,9 +460,7 @@ class MailMessage(models.Model): "res_partner_id": self.env.user.partner_id.id, "is_read": False, } - self.write( - {"notification_ids": [(0, 0, notification)]} - ) + self.write({"notification_ids": [(0, 0, notification)]}) for r in self.all_child_ids: r_vals = vals.copy() @@ -518,8 +514,7 @@ class MailMessage(models.Model): for record in reads: name = record["record_name"] or "" extended_name = " [{}] ID {}".format( - record.get("model", "UNDEF"), - record.get("res_id", "UNDEF"), + record.get("model", "UNDEF"), record.get("res_id", "UNDEF"), ) res.append((record["id"], name + extended_name)) return res diff --git a/mailgun/models/ir_config_parameter.py b/mailgun/models/ir_config_parameter.py index 84e6a2d..57d7eac 100644 --- a/mailgun/models/ir_config_parameter.py +++ b/mailgun/models/ir_config_parameter.py @@ -2,6 +2,7 @@ import logging import requests import simplejson + from odoo import api, models _logger = logging.getLogger(__name__)