Error message of cancel sales invoice or SO after update

Hello
Every time after we update our erpnext we can’t cancel sales invoices or sales orders and get below error message , we solve folder issue but again next time when we update erpnext again we have same issue for delete invoices or sales orders ,

Server Error

FileNotFoundError: [Errno 2] No such file or directory: ‘apps/erpnext/erpnext/healthcare/doctype/consultation’

any one have idea how to solve it ?
i guess when we active and then disable healthcare and manufacturing domain this problem started .


below details or error :upside_down_face:

App Versions

{
	"erpnext": "13.19.0",
	"frappe": "13.19.0",
}

Route

Form/Sales Invoice/INV-SHK00249

Trackeback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 68, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 31, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 68, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1208, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/linked_with.py", line 43, in get_submitted_linked_docs
    linked_docs = get_linked_docs(doctype, name, linkinfo)
  File "apps/frappe/frappe/desk/form/linked_with.py", line 170, in get_linked_docs
    link_meta_bundle = frappe.desk.form.load.get_meta_bundle(dt)
  File "apps/frappe/frappe/desk/form/load.py", line 81, in get_meta_bundle
    bundle = [frappe.desk.form.meta.get_meta(doctype)]
  File "apps/frappe/frappe/desk/form/meta.py", line 26, in get_meta
    meta = FormMeta(doctype)
  File "apps/frappe/frappe/desk/form/meta.py", line 39, in __init__
    self.load_assets()
  File "apps/frappe/frappe/desk/form/meta.py", line 49, in load_assets
    self.add_code()
  File "apps/frappe/frappe/desk/form/meta.py", line 107, in add_code
    self.add_html_templates(path)
  File "apps/frappe/frappe/desk/form/meta.py", line 120, in add_html_templates
    for fname in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: 'apps/erpnext/erpnext/healthcare/doctype/consultation'

Request Data

{
	"type": "POST",
	"args": {
		"doctype": "Sales Invoice",
		"name": "INV-SHK00249"
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.form.linked_with.get_submitted_linked_docs"
}

Response Data

{
	"exception": "FileNotFoundError: [Errno 2] No such file or directory: 'apps/erpnext/erpnext/healthcare/doctype/consultation'"
}

Looks like custom fields related to healthcare are causing this issue.

If you are not using healthcare module, you can go to custom fields and delete all custom fields related to healthcare.

Dear @ChillarAnand
Thank you for your reply , i didn’t find any custom fields related to healthcare .
could you please advise to find solution .
Regards

After disabling the healthcare domain, did you clear cache?

Also check for the specified location and see if files are actually present.

apps/erpnext/erpnext/healthcare/doctype/consultation
apps/erpnext/erpnext/manufacturing/doctype/production_order
1 Like

Dear @ChillarAnand
Thank you for your help , i tried to enable and disable healthcare and manufacturing domains and after each step i cleared cash , but still same issue .
I checked consultation and production_order folders don’t present .

apps/erpnext/erpnext/healthcare/doctype/consultation
apps/erpnext/erpnext/manufacturing/doctype/production_order

could you please help to find this issue .
Regards

This is also a concern of mine when trying to cancel a BOM:

App Versions

{
	"erpnext": "13.21.0",
	"frappe": "13.21.0"
}

Route

Form/BOM/BOM-BART HW BETA-001

Trackeback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 68, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 31, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 68, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1213, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/linked_with.py", line 43, in get_submitted_linked_docs
    linked_docs = get_linked_docs(doctype, name, linkinfo)
  File "apps/frappe/frappe/desk/form/linked_with.py", line 170, in get_linked_docs
    link_meta_bundle = frappe.desk.form.load.get_meta_bundle(dt)
  File "apps/frappe/frappe/desk/form/load.py", line 81, in get_meta_bundle
    bundle = [frappe.desk.form.meta.get_meta(doctype)]
  File "apps/frappe/frappe/desk/form/meta.py", line 26, in get_meta
    meta = FormMeta(doctype)
  File "apps/frappe/frappe/desk/form/meta.py", line 39, in __init__
    self.load_assets()
  File "apps/frappe/frappe/desk/form/meta.py", line 49, in load_assets
    self.add_code()
  File "apps/frappe/frappe/desk/form/meta.py", line 107, in add_code
    self.add_html_templates(path)
  File "apps/frappe/frappe/desk/form/meta.py", line 120, in add_html_templates
    for fname in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: 'apps/erpnext/erpnext/manufacturing/doctype/production_order'

Request Data

{
	"type": "POST",
	"args": {
		"doctype": "BOM",
		"name": "BOM-BART HW BETA-001"
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.form.linked_with.get_submitted_linked_docs"
}

Response Data

{
	"exception": "FileNotFoundError: [Errno 2] No such file or directory: 'apps/erpnext/erpnext/manufacturing/doctype/production_order'"
}
1 Like

This happens when I cancel the BOM on its own page, but does not happen when I mark the BOM in its list, and then Cancel there.

@meisam maybe this can help you _o/

1 Like

thank you so much , yes it’s help me a lot .
I market and then cancel and it’s work .
Hope erpnext team will solve this issue . @ChillarAnand

1 Like