Browse Source

💚 pre-commit: auto cleanups

pull/261/head
Ivan Yelizariev 5 years ago
parent
commit
18ec736f32
No known key found for this signature in database GPG Key ID: 93F14FB6A8B57057
  1. 2
      .isort.cfg
  2. 3
      mail_base/controllers/main.py
  3. 6
      mail_fix_553/mail_fix_553.py
  4. 11
      mail_move_message/mail_move_message_models.py
  5. 1
      mailgun/models/ir_config_parameter.py

2
.isort.cfg

@ -9,4 +9,4 @@ line_length=88
known_odoo=odoo known_odoo=odoo
known_odoo_addons=odoo.addons known_odoo_addons=odoo.addons
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
known_third_party=openerp,requests,simplejson,werkzeug
known_third_party=requests,simplejson,werkzeug

3
mail_base/controllers/main.py

@ -1,6 +1,7 @@
from odoo.addons.bus.controllers.main import BusController
from odoo.http import request from odoo.http import request
from odoo.addons.bus.controllers.main import BusController
class MailChatController(BusController): class MailChatController(BusController):
# ----------------------------- # -----------------------------

6
mail_fix_553/mail_fix_553.py

@ -4,11 +4,12 @@ import re
from email.utils import formataddr from email.utils import formataddr
from odoo import SUPERUSER_ID, tools from odoo import SUPERUSER_ID, tools
from odoo.addons.base.ir.ir_mail_server import MailDeliveryException
from odoo.osv import osv from odoo.osv import osv
from odoo.tools.safe_eval import safe_eval as eval from odoo.tools.safe_eval import safe_eval as eval
from odoo.tools.translate import _ from odoo.tools.translate import _
from odoo.addons.base.ir.ir_mail_server import MailDeliveryException
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@ -146,7 +147,8 @@ class MailMail(osv.Model):
attachments=attachments, attachments=attachments,
message_id=mail.message_id, message_id=mail.message_id,
references=mail.references, 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="html",
subtype_alternative="plain", subtype_alternative="plain",
headers=headers, headers=headers,

11
mail_move_message/mail_move_message_models.py

@ -412,9 +412,7 @@ class MailMessage(models.Model):
# building message tree # building message tree
return return
if not self.author_id: if not self.author_id:
self.write(
{"author_id": author.id}
)
self.write({"author_id": author.id})
vals = {} vals = {}
if move_back: if move_back:
@ -446,9 +444,7 @@ class MailMessage(models.Model):
"res_partner_id": self.env.user.partner_id.id, "res_partner_id": self.env.user.partner_id.id,
"is_read": False, "is_read": False,
} }
self.write(
{"notification_ids": [(0, 0, notification)]}
)
self.write({"notification_ids": [(0, 0, notification)]})
for r in self.all_child_ids: for r in self.all_child_ids:
r_vals = vals.copy() r_vals = vals.copy()
@ -501,8 +497,7 @@ class MailMessage(models.Model):
for record in reads: for record in reads:
name = record["record_name"] or "" name = record["record_name"] or ""
extended_name = " [{}] ID {}".format( 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)) res.append((record["id"], name + extended_name))
return res return res

1
mailgun/models/ir_config_parameter.py

@ -2,6 +2,7 @@ import logging
import requests import requests
import simplejson import simplejson
from odoo import api, models from odoo import api, models
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)

Loading…
Cancel
Save