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.

24 lines
792 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016-2017 Compassion CH (http://www.compassion.ch)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. import logging
  5. from odoo import http
  6. from odoo.addons.mail_tracking.controllers.main import \
  7. MailTrackingController, _env_get
  8. _logger = logging.getLogger(__name__)
  9. class SendgridTrackingController(MailTrackingController):
  10. """
  11. Sendgrid is posting JSON so we must define a new route for tracking.
  12. """
  13. @http.route('/mail/tracking/sendgrid/<string:db>',
  14. type='json', auth='none', csrf=False)
  15. def mail_tracking_sendgrid(self, db, **kw):
  16. try:
  17. _env_get(db, self._tracking_event, None, None, **kw)
  18. return {'status': 200}
  19. except:
  20. return {'status': 400}