Browse Source

🌈 pre-commit manual cleanup

pull/297/head
Denis Mudarisov 4 years ago
parent
commit
4c4e13b349
No known key found for this signature in database GPG Key ID: B9AD74DAFB7B53DA
  1. 0
      email_headers/README.md
  2. 6
      email_headers/__manifest__.py
  3. 12
      email_headers/models/mail.py
  4. 2
      email_headers/tests/test_email.py

0
email_headers/README.md

6
email_headers/__manifest__.py

@ -23,17 +23,17 @@
"name": "Default Email Headers",
"version": "13.0.1.2.0",
"license": "AGPL-3",
"description": """
"summary": """
Adds fields on outgoing email server that allows you to better control the
outgoing email headers and Reply-To addresses.
""",
"data": ["data/ir_config_parameter_data.xml", "views/ir_mail_server_views.xml",],
"data": ["data/ir_config_parameter_data.xml", "views/ir_mail_server_views.xml"],
"author": "Avoin.Systems",
"website": "https://avoin.systems",
"category": "Email",
"depends": ["mail"],
"external_dependencies": {
"python": ["Crypto.Cipher.AES",], # pip3 install pycryptodome
"python": ["Crypto.Cipher.AES"], # pip3 install pycryptodome
"bin": [],
},
"installable": True,

12
email_headers/models/mail.py

@ -57,15 +57,15 @@ def get_cipher(env):
)
def encode_msg_id(id, env):
id_padded = "%016d" % id
def encode_msg_id(msg_id, env):
id_padded = "%016d" % msg_id
encrypted = get_cipher(env).encrypt(id_padded.encode("utf-8"))
return base64.b32encode(encrypted).decode("utf-8")
# Remove in Odoo 14
def encode_msg_id_legacy(id, env):
id_padded = "%016d" % id
def encode_msg_id_legacy(msg_id, env):
id_padded = "%016d" % msg_id
encrypted = get_cipher(env).encrypt(id_padded.encode("utf-8"))
return base64.urlsafe_b64encode(encrypted).decode("utf-8")
@ -106,7 +106,7 @@ class MailServer(models.Model):
_inherit = "ir.mail_server"
reply_to_method = fields.Selection(
[("default", "Odoo Default"), ("alias", "Alias"), ("msg_id", "Message ID"),],
[("default", "Odoo Default"), ("alias", "Alias"), ("msg_id", "Message ID")],
"Reply-To Method",
default="default",
help="Odoo Default: Don't add any unique identifiers into the\n"
@ -573,7 +573,7 @@ class MailThread(models.AbstractModel):
message_id,
)
body = self.env.ref("mail.mail_bounce_catchall").render(
{"message": message,}, engine="ir.qweb"
{"message": message}, engine="ir.qweb"
)
self._routing_create_bounce_email(
email_from, body, message, reply_to=self.env.user.company_id.email

2
email_headers/tests/test_email.py

@ -1,3 +1,5 @@
# No need to translate tests
# pylint: disable=translation-required
from email.message import EmailMessage
import mock

Loading…
Cancel
Save