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.

30 lines
1015 B

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