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
791 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 Tecnativa - Antonio Espinosa
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. import json
  5. from openerp import models
  6. class IrMailServer(models.Model):
  7. _inherit = "ir.mail_server"
  8. def _tracking_headers_add(self, tracking_email_id, headers):
  9. headers = super(IrMailServer, self)._tracking_headers_add(
  10. tracking_email_id, headers)
  11. headers = headers or {}
  12. metadata = {
  13. # NOTE: We can not use 'self.env.cr.dbname' because self is
  14. # ir.mail_server object in old API (osv.osv)
  15. 'odoo_db': self.pool.db_name,
  16. 'tracking_email_id': tracking_email_id,
  17. }
  18. headers['X-Mailgun-Variables'] = json.dumps(metadata)
  19. return headers