Skip to content

Commit

Permalink
fix: check if field is_tree exists (#8328)
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabh6790 authored and netchampfaris committed Sep 3, 2019
1 parent 6939d54 commit 2f83e17
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frappe/model/base_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ def get_controller(doctype):
global _classes

if not doctype in _classes:
module_name, custom, is_tree = frappe.db.get_value("DocType", doctype, ("module", "custom", "is_tree"), cache=True) \
or ["Core", False, False]
module_name, custom = frappe.db.get_value("DocType", doctype, ("module", "custom"), cache=True) \
or ["Core", False]

if custom:
if frappe.db.field_exists(doctype, "is_tree"):
is_tree = frappe.db.get_value("DocType", doctype, ("is_tree"), cache=True)
else:
is_tree = False
_class = NestedSet if is_tree else Document
else:
module = load_doctype_module(doctype, module_name)
Expand Down

0 comments on commit 2f83e17

Please sign in to comment.