social/mail_tracking_mailgun/models/ir_mail_server.py

21 lines
636 B
Python
Raw Normal View History

# Copyright 2016 Tecnativa - Antonio Espinosa
2016-07-15 13:41:49 +02:00
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import json
from odoo import models
2016-07-15 13:41:49 +02:00
class IrMailServer(models.Model):
_inherit = "ir.mail_server"
def _tracking_headers_add(self, tracking_email_id, headers):
headers = super(IrMailServer, self)._tracking_headers_add(
tracking_email_id, headers)
headers = headers or {}
metadata = {
'odoo_db': self.env.cr.dbname,
2016-07-15 13:41:49 +02:00
'tracking_email_id': tracking_email_id,
}
headers['X-Mailgun-Variables'] = json.dumps(metadata)
return headers