Minor fixes in db_query and base_document
This commit is contained in:
parent
f6c1047a48
commit
580f1608da
2 changed files with 6 additions and 5 deletions
|
|
@ -231,10 +231,11 @@ class BaseDocument(object):
|
|||
|
||||
def _fix_numeric_types(self):
|
||||
for df in self.meta.get("fields"):
|
||||
if df.fieldtype in ("Int", "Check"):
|
||||
self.set(df.fieldname, cint(self.get(df.fieldname)))
|
||||
elif df.fieldtype in ("Float", "Currency"):
|
||||
self.set(df.fieldname, flt(self.get(df.fieldname)))
|
||||
if self.get(df.fieldname) is not None:
|
||||
if df.fieldtype in ("Int", "Check"):
|
||||
self.set(df.fieldname, cint(self.get(df.fieldname)))
|
||||
elif df.fieldtype in ("Float", "Currency"):
|
||||
self.set(df.fieldname, flt(self.get(df.fieldname)))
|
||||
|
||||
if self.docstatus is not None:
|
||||
self.docstatus = cint(self.docstatus)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class DatabaseQuery(object):
|
|||
limit_page_length=20, as_list=False, with_childnames=False, debug=False,
|
||||
ignore_permissions=False, user=None):
|
||||
if not ignore_permissions and not frappe.has_permission(self.doctype, "read", user=user):
|
||||
raise frappe.PermissionError
|
||||
raise frappe.PermissionError, self.doctype
|
||||
|
||||
if fields:
|
||||
self.fields = fields
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue