ImportError: Module import failed for Department Approver

Hi,
During the latest update I am getting the following error:

Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/erp_healthcare/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/erp_healthcare/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/erp_healthcare/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erp_healthcare/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erp_healthcare/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erp_healthcare/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/erp_healthcare/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/commands/site.py”, line 222, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/migrate.py”, line 39, in migrate
frappe.modules.patch_handler.run_all()
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/erp_healthcare/frappe-bench/apps/erpnext/erpnext/patches/v11_0/update_department_lft_rgt.py”, line 14, in execute
}).insert(ignore_permissions=True)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 211, in insert
self._set_defaults()
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 597, in _set_defaults
new_doc = frappe.new_doc(df.options, as_dict=True)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/init.py”, line 617, in new_doc
return get_new_doc(doctype, parent_doc, parentfield, as_dict=as_dict)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 20, in get_new_doc
frappe.local.new_doc_templates[doctype] = make_new_doc(doctype)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 38, in make_new_doc
“docstatus”: 0
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/init.py”, line 641, in get_doc
return frappe.model.document.get_doc(*args, **kwargs)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/document.py”, line 67, in get_doc
controller = get_controller(doctype)
File “/home/erp_healthcare/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 36, in get_controller
module = load_doctype_module(doctype, module_name)
File “/home/erp_healthcare/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 Department Approver (frappe.core.doctype.department_approver.department_approver Error: No module named department_approver.department_approver)

Can anybody guide me how to resolve the issue.

regards,

Amit

@shreya115 it seems that in the patch erpnext.patches.v11_0.update_department_lft_rgt, it is looking for the module department_approver in Core hence the error.

@Amit_Saxena, Thanks for reporting the issue. We have fixed this, should be merged, soon.

@shreya115 this bug looks the same type as this ImportError: Module import failed for Leave Application (erpnext.hr.doctype.leave_application.leave_application Error: No module named employee_leave_approver.employee_leave_approver) · Issue #13751 · frappe/erpnext · GitHub
any hint ?

Yep, it has been fixed as well.