From 9c04d4d070e170976a30d845310446c45cf9f448 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Wed, 7 Aug 2019 18:25:39 +0200 Subject: [PATCH] date to datetime conversion when autotyping --- report_xlsx_helper/report/report_xlsx_abstract.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/report_xlsx_helper/report/report_xlsx_abstract.py b/report_xlsx_helper/report/report_xlsx_abstract.py index 5b472cb4..0f55612a 100644 --- a/report_xlsx_helper/report/report_xlsx_abstract.py +++ b/report_xlsx_helper/report/report_xlsx_abstract.py @@ -1,7 +1,7 @@ # Copyright 2009-2018 Noviat. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from datetime import datetime +from datetime import datetime, date import re from types import CodeType from xlsxwriter.utility import xl_rowcol_to_cell @@ -503,6 +503,10 @@ class ReportXlsxAbstract(models.AbstractModel): cell_type = 'number' elif isinstance(cell_value, datetime): cell_type = 'datetime' + elif isinstance(cell_value, date): + cell_value = datetime.combine( + cell_value, datetime.min.time()) + cell_type = 'datetime' else: if not cell_value: cell_type = 'blank'