def get_server_obj(doc, doclist = [], basedoctype = ''): # for test import webnotes from webnotes.modules import scrub, get_doctype_module from core.doctype.custom_script.custom_script import get_custom_server_script # get doctype details module = get_doctype_module(doc.doctype) or "core" if not module: return DocType = get_doctype_class(doc.doctype, module) # custom? custom_script = get_custom_server_script(doc.doctype) if custom_script: global custom_class exec custom_class + custom_script.replace('\t',' ') in locals() return CustomDocType(doc, doclist) else: return DocType(doc, doclist)
def get_server_obj(doc, doclist = [], basedoctype = ''): # for test import webnotes from webnotes.modules import scrub, get_doctype_module from core.doctype.custom_script.custom_script import get_custom_server_script # get doctype details module = get_doctype_module(doc.doctype) or "core" if not module: return DocType = get_doctype_class(doc.doctype, module) if webnotes.flags.in_import: return DocType(doc, doclist) # custom? custom_script = get_custom_server_script(doc.doctype) if custom_script: opts = {"DocType": DocType} exec custom_script in opts return opts["CustomDocType"](doc, doclist) else: return DocType(doc, doclist)
def get_server_obj(doc, doclist=[], basedoctype=''): # for test import webnotes from webnotes.modules import scrub, get_doctype_module from core.doctype.custom_script.custom_script import get_custom_server_script # get doctype details module = get_doctype_module(doc.doctype) or "core" if not module: return DocType = get_doctype_class(doc.doctype, module) # custom? custom_script = get_custom_server_script(doc.doctype) if custom_script: global custom_class exec custom_class + custom_script.replace('\t', ' ') in locals() return CustomDocType(doc, doclist) else: return DocType(doc, doclist)