You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1000 B

  1. # Copyright 2017 Tecnativa - Jairo Llopis <jairo.llopis@tecnativa.com>
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import api, models
  4. class MailThread(models.AbstractModel):
  5. _inherit = "mail.thread"
  6. @api.model
  7. def message_process(self, model, message, custom_values=None,
  8. save_original=False, strip_attachments=False,
  9. thread_id=None):
  10. server = self.env["fetchmail.server"].browse(
  11. self.env.context.get("fetchmail_server_id"))
  12. if server.default_thread_id and not (model or thread_id):
  13. model = server.default_thread_id._name
  14. thread_id = server.default_thread_id.id
  15. return super(
  16. MailThread,
  17. self.with_context(mail_create_nosubscribe=True)
  18. ).message_process(
  19. model,
  20. message,
  21. custom_values,
  22. save_original,
  23. strip_attachments,
  24. thread_id,
  25. )