From 1dd3d36b485116f3a70720756ba65e166573c2cd Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 12 Jun 2017 18:13:24 +0200 Subject: [PATCH] [FIX] point_of_sale: timezoned sales details When printing the sales details of the day in the point of sale interface, The orders printed were the orders of the UTC day, not the orders of the day within the user timezone. opw-745273 --- addons/point_of_sale/models/pos_order.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 6f2972dc404..0454cbf203c 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -5,6 +5,7 @@ from datetime import timedelta from functools import partial import psycopg2 +import pytz from odoo import api, fields, models, tools, _ from odoo.tools import float_is_zero @@ -907,7 +908,9 @@ class ReportSaleDetails(models.AbstractModel): if not configs: configs = self.env['pos.config'].search([]) - today = fields.Datetime.from_string(fields.Date.context_today(self)) + user_tz = pytz.timezone(self.env.context.get('tz') or self.env.user.tz or 'UTC') + today = user_tz.localize(fields.Datetime.from_string(fields.Date.context_today(self))) + today = today.astimezone(pytz.timezone('UTC')) if date_start: date_start = fields.Datetime.from_string(date_start) else: