fix: Use Document in case get_controller raises import errors

This commit is contained in:
Gavin D'souza 2020-01-18 04:11:19 +05:30
parent ce4253c631
commit a3b79081d6

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)