Browse Source

Merge pull request #1214 from Eficent/10.0-mig-mail_log_messages_to_process

[10.0][MIG] mail_log_messages_to_process
pull/1215/merge
Jordi Ballester Alomar 6 years ago
committed by GitHub
parent
commit
a4f5596cbd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 51
      mail_log_message_to_process/README.rst
  2. 4
      mail_log_message_to_process/__init__.py
  3. 16
      mail_log_message_to_process/__manifest__.py
  4. 24
      mail_log_message_to_process/i18n/ca.po
  5. 24
      mail_log_message_to_process/i18n/de.po
  6. 24
      mail_log_message_to_process/i18n/es.po
  7. 24
      mail_log_message_to_process/i18n/fr.po
  8. 24
      mail_log_message_to_process/i18n/it.po
  9. 24
      mail_log_message_to_process/i18n/pt_BR.po
  10. 24
      mail_log_message_to_process/i18n/pt_PT.po
  11. 24
      mail_log_message_to_process/i18n/sl.po
  12. 24
      mail_log_message_to_process/i18n/tr.po
  13. 4
      mail_log_message_to_process/models/__init__.py
  14. 81
      mail_log_message_to_process/models/mail_thread.py
  15. BIN
      mail_log_message_to_process/static/description/icon.png

51
mail_log_message_to_process/README.rst

@ -0,0 +1,51 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
===========================
Mail log message to process
===========================
This module allows to log into the server the basic information of emails
that have been fetched from the mail server, before they start to be processed.
This allows for a better analysis of situations where emails are found to be
missing in Odoo. Can help to better resolve questions of the type 'Was it that
the email was never fetched, or a problem found when it was processed by
Odoo?'.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/10.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Jordi Ballester <jordi.ballester@eficent.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

4
mail_log_message_to_process/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models

16
mail_log_message_to_process/__manifest__.py

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# © 2017 Eficent Business and IT Consulting Services S.L. (www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
'name': 'Mail Log Message to Process',
'version': '10.0.1.0.0',
'category': 'Tools',
'summary': 'Log all messages received, before they start to be processed.',
'author': "Eficent, "
"Odoo Community Association (OCA)",
'license': 'AGPL-3',
'website': 'https://github.com/OCA/server-tools',
'depends': ['mail'],
'installable': True,
}

24
mail_log_message_to_process/i18n/ca.po

@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_log_messages_to_process
#
# Translators:
# Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-21 22:54+0000\n"
"PO-Revision-Date: 2017-10-21 22:54+0000\n"
"Last-Translator: Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017\n"
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ca\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: mail_log_messages_to_process
#: model:ir.model,name:mail_log_messages_to_process.model_mail_thread
msgid "Email Thread"
msgstr "Tema del Correu electrònic "

24
mail_log_message_to_process/i18n/de.po

@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_log_messages_to_process
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-21 22:54+0000\n"
"PO-Revision-Date: 2017-10-21 22:54+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: mail_log_messages_to_process
#: model:ir.model,name:mail_log_messages_to_process.model_mail_thread
msgid "Email Thread"
msgstr "Email-Thread"

24
mail_log_message_to_process/i18n/es.po

@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_log_messages_to_process
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-21 22:54+0000\n"
"PO-Revision-Date: 2017-10-21 22:54+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: mail_log_messages_to_process
#: model:ir.model,name:mail_log_messages_to_process.model_mail_thread
msgid "Email Thread"
msgstr "Hilo correo electrónico"

24
mail_log_message_to_process/i18n/fr.po

@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_log_messages_to_process
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-21 22:54+0000\n"
"PO-Revision-Date: 2017-10-21 22:54+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: mail_log_messages_to_process
#: model:ir.model,name:mail_log_messages_to_process.model_mail_thread
msgid "Email Thread"
msgstr "Discussion de courriel"

24
mail_log_message_to_process/i18n/it.po

@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_log_messages_to_process
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-21 22:54+0000\n"
"PO-Revision-Date: 2017-10-21 22:54+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: mail_log_messages_to_process
#: model:ir.model,name:mail_log_messages_to_process.model_mail_thread
msgid "Email Thread"
msgstr "Discussione Email"

24
mail_log_message_to_process/i18n/pt_BR.po

@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_log_messages_to_process
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-21 22:54+0000\n"
"PO-Revision-Date: 2017-10-21 22:54+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: mail_log_messages_to_process
#: model:ir.model,name:mail_log_messages_to_process.model_mail_thread
msgid "Email Thread"
msgstr "Processo Email"

24
mail_log_message_to_process/i18n/pt_PT.po

@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_log_messages_to_process
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-21 22:54+0000\n"
"PO-Revision-Date: 2017-10-21 22:54+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Portuguese (Portugal) (https://www.transifex.com/oca/teams/23907/pt_PT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_PT\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: mail_log_messages_to_process
#: model:ir.model,name:mail_log_messages_to_process.model_mail_thread
msgid "Email Thread"
msgstr "Tópico de Email"

24
mail_log_message_to_process/i18n/sl.po

@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_log_messages_to_process
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-21 22:54+0000\n"
"PO-Revision-Date: 2017-10-21 22:54+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: mail_log_messages_to_process
#: model:ir.model,name:mail_log_messages_to_process.model_mail_thread
msgid "Email Thread"
msgstr "E-poštna nit"

24
mail_log_message_to_process/i18n/tr.po

@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_log_messages_to_process
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-21 22:54+0000\n"
"PO-Revision-Date: 2017-10-21 22:54+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: tr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: mail_log_messages_to_process
#: model:ir.model,name:mail_log_messages_to_process.model_mail_thread
msgid "Email Thread"
msgstr "Eposta konuşması"

4
mail_log_message_to_process/models/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import mail_thread

81
mail_log_message_to_process/models/mail_thread.py

@ -0,0 +1,81 @@
# -*- coding: utf-8 -*-
# Copyright 2017-18 Eficent Business and IT Consulting Services S.L.
# (www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import email
import xmlrpclib
import logging
from email.message import Message
from odoo import api, models
from odoo.tools import decode_smtp_header as decode
_logger = logging.getLogger(__name__)
class MailThread(models.AbstractModel):
_inherit = 'mail.thread'
@api.model
def message_parse_basic_data(self, message):
"""Parses a string or email.message.Message representing an RFC-2822
email, and returns a generic dict holding the message details.
:param message: the message to parse
:rtype: dict
:return: A dict with the following structure, where each field
may not be present if missing in original message:
{ 'message_id': msg_id,
'subject': subject,
'from': from,
'to': to,
'cc': cc
}
"""
msg_dict = {
'message_type': 'email',
}
if not isinstance(message, Message):
if isinstance(message, unicode):
# Warning: message_from_string doesn't always work
# correctly on unicode, we must use utf-8 strings here :-(
message = message.encode('utf-8')
message = email.message_from_string(message)
message_id = message['message-id']
if not message_id:
message_id = 'None'
msg_dict['message_id'] = message_id
if message.get('Subject'):
msg_dict['subject'] = decode(message.get('Subject'))
# Envelope fields not stored in mail.message but made available
# for message_new()
msg_dict['from'] = decode(message.get('from'))
msg_dict['to'] = decode(message.get('to'))
msg_dict['cc'] = decode(message.get('cc'))
msg_dict['email_from'] = decode(message.get('from'))
return msg_dict
@api.model
def message_process(self, model, message, custom_values=None,
save_original=False, strip_attachments=False,
thread_id=None):
if isinstance(message, xmlrpclib.Binary):
message = str(message.data)
# Warning: message_from_string doesn't always work correctly on
# unicode, we must use utf-8 strings here :-(
if isinstance(message, unicode):
message = message.encode('utf-8')
msg_txt = email.message_from_string(message)
msg = self.message_parse_basic_data(msg_txt)
_logger.info(
'Fetched mail from %s to %s with Message-Id %s',
msg.get('from'), msg.get('to'), msg.get('message_id'))
return super(MailThread, self).message_process(
model, message, custom_values=custom_values,
save_original=save_original,
strip_attachments=strip_attachments, thread_id=thread_id)

BIN
mail_log_message_to_process/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

Loading…
Cancel
Save