diff --git a/controllers/main.py b/controllers/main.py index a51a191..9923109 100644 --- a/controllers/main.py +++ b/controllers/main.py @@ -6,6 +6,7 @@ from odoo import http from odoo.http import request from odoo.http import Response from datetime import datetime +from pytz import timezone class Main(http.Controller): @@ -21,11 +22,33 @@ 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 = datetime( + today_datetime2.year, + today_datetime2.month, + today_datetime2.day, + 00, + 00, + 00) transaction_ids = request.env[ - 'pos.transaction'].sudo().search([]) + 'pos.transaction'].sudo().search([('create_date', '>=', today_datetime)]) balance_id = pos_sessions.config_id.balance_id - if hasattr(datetime.today(), 'isoformat'): - date = datetime.today().isoformat() + + 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() data = { 'balance_id': balance_id, 'date': date,