Wednesday, April 26, 2023
1 change
Resolved issues and error corrections
Cohort reports no longer fail when they are based on date-only fields. This prevents an error screen and helps users reliably view cohort analysis for records that use dates instead of date-times.
Original PR description
Since b0a952ab1ba132de863c59b251fff8c8942de640,
get_cohort_data doesn't work with `fields.Date`:
File "/data/build/odoo/odoo/api.py", line 430, in _call_kw_model
result = method(recs, *args, **kwargs)
File "/data/build/enterprise/web_cohort/models/models.py", line 91, in get_cohort_data
if col_start_date > datetime.today():
TypeError: can't compare datetime.datetime to datetime.date
Previously every date/datetime string (result of `_read_group_raw`) was converted into datetime. Now _read_group return the same date type than the field used.
Fix this issue.