[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) <vlst@odoo.com> Signed-off-by: Robin Engels (roen) <roen@odoo.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user