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.

22 lines
735 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. import json
  5. import threading
  6. from openerp import models
  7. class IrMailServer(models.Model):
  8. _inherit = "ir.mail_server"
  9. def _tracking_headers_add(self, tracking_email_id, headers):
  10. headers = super(IrMailServer, self)._tracking_headers_add(
  11. tracking_email_id, headers)
  12. headers = headers or {}
  13. metadata = {
  14. 'odoo_db': getattr(threading.currentThread(), 'dbname', None),
  15. 'tracking_email_id': tracking_email_id,
  16. }
  17. headers['X-Mailgun-Variables'] = json.dumps(metadata)
  18. return headers