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.

23 lines
849 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. """Sendgrid is posting JSON so we must define a new route for tracking."""
  11. @http.route('/mail/tracking/sendgrid/<string:db>',
  12. type='json', auth='none', csrf=False)
  13. def mail_tracking_sendgrid(self, db, **kw):
  14. try:
  15. _env_get(db, self._tracking_event, None, None, **kw)
  16. return {'status': 200}
  17. except Exception as e:
  18. _logger.error(e.message, exc_info=True)
  19. return {'status': 400}