Error doctype delivery charges not found while migrating site

I uninstalles pos awesome after that i am facing problem with doctype like i was not able to acess sales invoice it was saying doctype pos offer not found now i am unable to update my site there is a error while migrating
“frappe.core.doctype.doctype.doctype.WrongOptionsDoctypeLinkError: Address: Options must be a valid DocType for field Delivery Charges in row 21”

any one know how to fix this issue.

There is no such doctype Named Delivery Charges it must be your custom Doctype.

anybody solve this issue ?

Why such an issue can occur?
For any app installed, there are some custom fields and doctypes installed.
However, when you uninstall the app, only doctypes are removed. Custom Fields Stay.

You get this error when there are link fields linked to removed doctypes.

How to resolve?
Delete linked custom fields.

These are the fields created. Search for Link and delete them from bench console.

You can use something like this as all field names start with posa_

frappe.db.delete("Custom Field", filters={"fieldname": ["like", "posa_%"]})

This should resolve your issue.

Possibly, Not actually- no customization by the user, someone else also reported the same error some days back to me on telegram. It could be due to some additional app which (non tech) users are not aware.
He didn’t customize any sort. Infact was also hosted on erp cloud instance!

@Smit_Vora Request you to put a disclaimer of Data Backup and removing field will loose data!

Only custom fields shall be deleted.

Actual data saved in those custom fields will not be deleted.

Data can be viewed again by installing the app again / recreating the fields.

1 Like

A better script can be run in the console, where you don’t what to delete old fields.

table = frappe.qb.DocType("Custom Field")
frappe.qb.update(table).set(table.fieldtype, "Data").set(table.options, "").where("posa_%")).where(table.fieldtype == "Link").run()

This will convert fields with field type Link to Data.

1 Like

thank you