fix: Accurately cast fieldtype in frappe.db.get_single_value()

This commit is contained in:
Mitul David 2021-07-06 13:28:18 +05:30 committed by GitHub
parent 9fdde15841
commit a1e84d2341
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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