fix: Use older logic to set module_name and custom vars

(cherry picked from commit 87ed7796de)
This commit is contained in:
Gavin D'souza 2021-04-23 12:43:13 +05:30 committed by mergify-bot
parent b343db84a0
commit 34372e278e

View file

@ -34,15 +34,9 @@ def get_controller(doctype):
from frappe.model.document import Document
from frappe.utils.nestedset import NestedSet
if frappe.flags.in_migrate or frappe.flags.in_install or frappe.flags.in_patch:
module_name, custom = ["Core", False]
else:
# this could be simplified in PY3.8 using walrus operators
result = frappe.db.get_value("DocType", doctype, ("module", "custom"), cache=True)
if result:
module_name, custom = result
else:
module_name, custom = ["Core", bool(not frappe.db.exists(doctype))]
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"):