fix: Use Document in case get_controller raises import errors

(cherry picked from commit a3b79081d6)
This commit is contained in:
Gavin D'souza 2020-01-18 04:11:19 +05:30 committed by mergify-bot
parent 1e55ab34c3
commit 804e4e212d

View file

@ -109,7 +109,11 @@ class DocType(Document):
from frappe.model.base_document import get_controller
controller = get_controller(self.name)
try:
controller = get_controller(self.name)
except ImportError:
controller = Document
available_objects = {x for x in dir(controller) if isinstance(x, str)}
property_set = {
x for x in available_objects if isinstance(getattr(controller, x, None), property)