Browse Source

Modif envoi date

12.0
Juliana 5 years ago
parent
commit
e66d3ca661
  1. 29
      controllers/main.py

29
controllers/main.py

@ -6,6 +6,7 @@ from odoo import http
from odoo.http import request from odoo.http import request
from odoo.http import Response from odoo.http import Response
from datetime import datetime from datetime import datetime
from pytz import timezone
class Main(http.Controller): class Main(http.Controller):
@ -21,11 +22,33 @@ class Main(http.Controller):
transaction_ids = request.env[ transaction_ids = request.env[
'pos.transaction'].sudo().search([('create_date', '>=', date_get)]) 'pos.transaction'].sudo().search([('create_date', '>=', date_get)])
else: 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[ transaction_ids = request.env[
'pos.transaction'].sudo().search([])
'pos.transaction'].sudo().search([('create_date', '>=', today_datetime)])
balance_id = pos_sessions.config_id.balance_id 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 = { data = {
'balance_id': balance_id, 'balance_id': balance_id,
'date': date, 'date': date,

Loading…
Cancel
Save