From 22a10e1eb26293f6f064f118c74fb5aabf9cd42b Mon Sep 17 00:00:00 2001 From: roen-odoo Date: Tue, 19 Sep 2023 11:54:53 +0000 Subject: [PATCH] [FIX] point of sale: check if config_currencies null A traceback is generated if config currencies are none. This is because we are trying to access the 0 index which does not exist in a None object. Steps to reproduce: 1. Go to studio. 2. Click on reports. 3. Search for sale details. 4. Click on sale details report. Current Behavior: As we click on the sales details report, a traceback pops up. Expected Behavior: There should be no traceback and the report editor should open smoothly if nothing wrong. Note: We also remove Timezone information from the start_date to match the format of the date when it's provided by the user. e.g. : "23/05/2024 08:25:34" instead of "23/05/2024 08:25:34 TZInfo" OPW-3501650 closes odoo/odoo#140575 X-original-commit: c816f47eaabcb2aedce91887287f34ac8f16320a Signed-off-by: Vlad Stroia (vlst) Signed-off-by: Robin Engels (roen) --- addons/point_of_sale/models/report_sale_details.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/report_sale_details.py b/addons/point_of_sale/models/report_sale_details.py index cceefe214d3..ea16e693158 100644 --- a/addons/point_of_sale/models/report_sale_details.py +++ b/addons/point_of_sale/models/report_sale_details.py @@ -36,7 +36,7 @@ class ReportSaleDetails(models.AbstractModel): # start by default today 00:00:00 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))) - date_start = today.astimezone(pytz.timezone('UTC')) + date_start = today.astimezone(pytz.timezone('UTC')).replace(tzinfo=None) if date_stop: date_stop = fields.Datetime.from_string(date_stop)