Browse Source

fix: Use older logic to set module_name and custom vars

(cherry picked from commit 87ed7796de)
version-14
Gavin D'souza 4 years ago
committed by mergify-bot
parent
commit
34372e278e
1 changed files with 3 additions and 9 deletions
  1. +3
    -9
      frappe/model/base_document.py

+ 3
- 9
frappe/model/base_document.py View File

@@ -34,15 +34,9 @@ def get_controller(doctype):
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils.nestedset import NestedSet 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 custom:
if frappe.db.field_exists("DocType", "is_tree"): if frappe.db.field_exists("DocType", "is_tree"):


Loading…
Cancel
Save