From a1e84d234108c950d2d00a3df0eb70247c154966 Mon Sep 17 00:00:00 2001 From: Mitul David <49085834+MitulDavid@users.noreply.github.com> Date: Tue, 6 Jul 2021 13:28:18 +0530 Subject: [PATCH] fix: Accurately cast fieldtype in frappe.db.get_single_value() --- frappe/database/database.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frappe/database/database.py b/frappe/database/database.py index 81e24cc7ad..d113adcdab 100644 --- a/frappe/database/database.py +++ b/frappe/database/database.py @@ -15,7 +15,7 @@ from frappe import _ from time import time from frappe.utils import now, getdate, cast_fieldtype, get_datetime from frappe.model.utils.link_count import flush_local_link_count -from frappe.utils import cint +from frappe.utils import cint, cast_fieldtype class Database(object): @@ -556,8 +556,7 @@ class Database(object): if not df: frappe.throw(_('Invalid field name: {0}').format(frappe.bold(fieldname)), self.InvalidColumnName) - if df.fieldtype in frappe.model.numeric_fieldtypes: - val = cint(val) + val = cast_fieldtype(df.fieldtype, val) self.value_cache[doctype][fieldname] = val