Skip to content

Commit

Permalink
Merge PR #1550 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jan 21, 2025
2 parents cc06668 + bcfc8fc commit 7050dc8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions mail_tracking/models/mail_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import time
from datetime import datetime
from datetime import datetime, timezone
from email.utils import COMMASPACE

from odoo import fields, models
Expand All @@ -14,7 +14,7 @@ class MailMail(models.Model):
def _tracking_email_prepare(self, email):
"""Prepare email.tracking.email record values"""
ts = time.time()
dt = datetime.utcfromtimestamp(ts)
dt = datetime.fromtimestamp(ts, tz=timezone.utc)
email_to_list = email.get("email_to", [])
email_to = COMMASPACE.join(email_to_list)
return {
Expand Down
4 changes: 2 additions & 2 deletions mail_tracking/models/mail_tracking_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import time
import urllib.parse
import uuid
from datetime import datetime
from datetime import datetime, timezone

from odoo import _, api, fields, models, tools
from odoo.exceptions import AccessError
Expand Down Expand Up @@ -395,7 +395,7 @@ def _message_partners_check(self, message, message_id):
def _tracking_sent_prepare(self, mail_server, smtp_server, message, message_id):
self.ensure_one()
ts = time.time()
dt = datetime.utcfromtimestamp(ts)
dt = datetime.fromtimestamp(ts, tz=timezone.utc)
self._message_partners_check(message, message_id)
self.sudo().write({"state": "sent"})
return {
Expand Down
4 changes: 2 additions & 2 deletions mail_tracking/models/mail_tracking_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import re
import time
from datetime import datetime
from datetime import datetime, timezone

from odoo import api, fields, models

Expand Down Expand Up @@ -84,7 +84,7 @@ def _compute_date(self):

def _process_data(self, tracking_email, metadata, event_type, state):
ts = time.time()
dt = datetime.utcfromtimestamp(ts)
dt = datetime.fromtimestamp(ts, tz=timezone.utc)
return {
"recipient": metadata.get("recipient", tracking_email.recipient),
"timestamp": metadata.get("timestamp", ts),
Expand Down

0 comments on commit 7050dc8

Please sign in to comment.