fix(db): Cast single dt field only if value is truthy

This commit is contained in:
Gavin D'souza 2021-08-20 11:03:06 +05:30
parent 4cbf2c40e6
commit 623998c787

View file

@ -557,7 +557,10 @@ class Database(object):
if not df:
frappe.throw(_('Invalid field name: {0}').format(frappe.bold(fieldname)), self.InvalidColumnName)
val = cast_fieldtype(df.fieldtype, val)
# cast only if value is "set" or is truthy?
# cast_fieldtype returns currnt TS value for Datetime, Date fields
if val:
val = cast_fieldtype(df.fieldtype, val)
self.value_cache[doctype][fieldname] = val