Skip to content
Extraits de code Groupes Projets
Valider e795367b rédigé par Julien - Le Filament's avatar Julien - Le Filament
Parcourir les fichiers

[FIX] generate timestamp to utc

parent 369a350d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!8[FIX] generate timestamp to utc
......@@ -3,6 +3,7 @@ Repartion key entry file handler
"""
import csv
from datetime import datetime
from odoo.addons.api_connector.tools.date_utils import local_to_utc
class RepartitionKeyEntryFile:
......@@ -80,7 +81,7 @@ class RepartitionKeyEntryFile:
return max(self.json)
def data_to_send(self, send_empty_key=True):
def data_to_send(self, send_empty_key=True, convert_to_utc=True):
"""
build route and body for api sending
return dict {"route", "body} to enedis
......@@ -88,8 +89,11 @@ class RepartitionKeyEntryFile:
call_list = []
for horo in self.json:
date = datetime.strptime(horo, "%d-%m-%Y %H:%M")
if convert_to_utc:
date = local_to_utc(date, "Europe/Paris")
timestamp = date.strftime("%Y%m%dT%H%M%SZ")
body = []
for key in self.json.get(horo):
if send_empty_key:
body.append(key)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter