Browse Source

Minor fixes in db_query and base_document

version-14
Anand Doshi 11 years ago
parent
commit
580f1608da
2 changed files with 6 additions and 5 deletions
  1. +5
    -4
      frappe/model/base_document.py
  2. +1
    -1
      frappe/model/db_query.py

+ 5
- 4
frappe/model/base_document.py View File

@@ -231,10 +231,11 @@ class BaseDocument(object):


def _fix_numeric_types(self): def _fix_numeric_types(self):
for df in self.meta.get("fields"): 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: if self.docstatus is not None:
self.docstatus = cint(self.docstatus) self.docstatus = cint(self.docstatus)


+ 1
- 1
frappe/model/db_query.py View File

@@ -24,7 +24,7 @@ class DatabaseQuery(object):
limit_page_length=20, as_list=False, with_childnames=False, debug=False, limit_page_length=20, as_list=False, with_childnames=False, debug=False,
ignore_permissions=False, user=None): ignore_permissions=False, user=None):
if not ignore_permissions and not frappe.has_permission(self.doctype, "read", user=user): if not ignore_permissions and not frappe.has_permission(self.doctype, "read", user=user):
raise frappe.PermissionError
raise frappe.PermissionError, self.doctype


if fields: if fields:
self.fields = fields self.fields = fields


Loading…
Cancel
Save