What is "get_descendants_of"? How can i solve this?


Some ideas and suggestions -

For search purposes please post your full traceback as text not a screenshot

For q&a pointer clues search the forum for ‘ImportError: Module import failed for’

If you have server access, search the code for say ‘get_descendants_of’

I have got this error on several doctype don’t know how can I solve this.

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 61, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1019, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/load.py”, line 71, in getdoctype
docs = get_meta_bundle(doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/load.py”, line 81, in get_meta_bundle
bundle = [frappe.desk.form.meta.get_meta(doctype)]
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 26, in get_meta
meta = FormMeta(doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 39, in init
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 53, in load_assets
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py”, line 174, in load_templates
module = load_doctype_module(self.name)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 187, in load_doctype_module
raise ImportError(‘Module import failed for {0} ({1})’.format(doctype, module_name + ’ Error: ’ + str(e)))
ImportError: Module import failed for Salary Slip (erpnext.hr.doctype.salary_slip.salary_slip Error: cannot import name get_descendants_of)

can you post your erpnext and frappe versions ? click on the about button in Help menu on desk

Maybe a circular reference or import case as nabin notes

Too bad I am not informed how to analyse and resolve this - IMHO one misfortune of untyped languages like Python!

"erpnext": "11.1.21",
"frappe": "11.1.3"

What particular DocType contexts are you using where these exceptions occur? Perhaps attach a screenshot and give what steps to replicate these.

That method send seems only to be referenced in Accounts validation:

frappe@ubuntu:~/frappe-bench$ find . -name ‘*.py’ | xargs grep get_descendants_of
./apps/erpnext/erpnext/accounts/doctype/account/account.py:from frappe.utils.nestedset import NestedSet, get_ancestors_of, get_descendants_of
./apps/erpnext/erpnext/accounts/doctype/account/account.py: descendants = get_descendants_of(‘Company’, self.company)
./apps/frappe/frappe/utils/nestedset.py:def get_descendants_of(doctype, name, order_by=“lft desc”, limit=None):