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.

31 lines
1.0 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright - 2013-2018 Therp BV <https://therp.nl>.
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from .base import Base
  5. class OdooStandard(Base):
  6. """No search at all. Use Odoo's standard mechanism to attach mails to
  7. mail.thread objects. Note that this algorithm always matches."""
  8. name = 'Odoo standard'
  9. readonly_fields = [
  10. 'model_field',
  11. 'mail_field',
  12. 'match_first',
  13. 'domain',
  14. 'model_order',
  15. 'flag_nonmatching',
  16. ]
  17. def search_matches(self, folder, mail_message):
  18. """Always match. Duplicates will be fished out by message_id"""
  19. return [True]
  20. def handle_match(
  21. self, connection, match_object, folder,
  22. mail_message, mail_message_org, msgid):
  23. thread_model = folder.env['mail.thread']
  24. thread_model.message_process(
  25. folder.model_id.model, mail_message_org,
  26. save_original=folder.server_id.original,
  27. strip_attachments=(not folder.server_id.attach))