Browse Source

Pb heure UTC/timezone

12.0
Juliana 5 years ago
parent
commit
659d6c53bc
  1. 25
      controllers/main.py

25
controllers/main.py

@ -5,7 +5,7 @@ import json
from odoo import http
from odoo.http import request
from odoo.http import Response
from datetime import datetime
from datetime import datetime, date
from pytz import timezone
@ -22,33 +22,24 @@ class Main(http.Controller):
transaction_ids = request.env[
'pos.transaction'].sudo().search([('create_date', '>=', date_get)])
else:
today_datetime_utc = datetime.now(timezone('UTC'))
today_datetime2 = today_datetime_utc.astimezone(timezone('Europe/Berlin'))
today_datetime_utc = datetime.now()
today_datetime = datetime(
today_datetime2.year,
today_datetime2.month,
today_datetime2.day,
today_datetime_utc.year,
today_datetime_utc.month,
today_datetime_utc.day,
00,
00,
00)
transaction_ids = request.env[
'pos.transaction'].sudo().search([('create_date', '>=', today_datetime)])
balance_id = pos_sessions.config_id.balance_id
today_datetime_utc = datetime.now(timezone('UTC'))
today_datetime2 = today_datetime_utc.astimezone(timezone('Europe/Berlin'))
today_datetime = datetime(
today_datetime2.year,
today_datetime2.month,
today_datetime2.day,
today_datetime2.hour,
today_datetime2.minute,
today_datetime2.second)
if hasattr(today_datetime, 'isoformat'):
date = today_datetime.isoformat()
if hasattr(today_datetime_utc, 'isoformat'):
date = today_datetime_utc.isoformat('T')[:19]
data = {
'balance_id': balance_id,
'date': date,

Loading…
Cancel
Save