fix: as_dict

- convert_dates_to_str should work for non df fields
This commit is contained in:
Faris Ansari 2019-09-24 16:30:19 +05:30
parent cd3ee90262
commit fbfa078147

View file

@ -233,8 +233,8 @@ class BaseDocument(object):
if isinstance(d[fieldname], list) and df.fieldtype not in table_fields:
frappe.throw(_('Value for {0} cannot be a list').format(_(df.label)))
if convert_dates_to_str and isinstance(d[fieldname], (datetime.datetime, datetime.time, datetime.timedelta)):
d[fieldname] = str(d[fieldname])
if convert_dates_to_str and isinstance(d[fieldname], (datetime.datetime, datetime.time, datetime.timedelta)):
d[fieldname] = str(d[fieldname])
if d[fieldname] == None and ignore_nulls:
del d[fieldname]