Browse Source

date to datetime conversion when autotyping

pull/311/head
Luc De Meyer 5 years ago
parent
commit
9c04d4d070
  1. 6
      report_xlsx_helper/report/report_xlsx_abstract.py

6
report_xlsx_helper/report/report_xlsx_abstract.py

@ -1,7 +1,7 @@
# Copyright 2009-2018 Noviat. # Copyright 2009-2018 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import datetime
from datetime import datetime, date
import re import re
from types import CodeType from types import CodeType
from xlsxwriter.utility import xl_rowcol_to_cell from xlsxwriter.utility import xl_rowcol_to_cell
@ -503,6 +503,10 @@ class ReportXlsxAbstract(models.AbstractModel):
cell_type = 'number' cell_type = 'number'
elif isinstance(cell_value, datetime): elif isinstance(cell_value, datetime):
cell_type = 'datetime' cell_type = 'datetime'
elif isinstance(cell_value, date):
cell_value = datetime.combine(
cell_value, datetime.min.time())
cell_type = 'datetime'
else: else:
if not cell_value: if not cell_value:
cell_type = 'blank' cell_type = 'blank'

Loading…
Cancel
Save