While converting a version-12 to version-13, I got the following error:
~/frappe-bench$ bench switch-to-branch version-13 frappe erpnext --upgrade
...
...
~/frappe-bench$ bench update --patch
Backing up sites...
...
...
Executing erpnext.patches.v13_0.delete_old_purchase_reports
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 101, in <module>
main()
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
click.Group(commands=commands)(prog_name='bench')
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 27, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 300, in migrate
skip_search_index=skip_search_index
File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 67, in migrate
frappe.modules.patch_handler.run_all(skip_failing)
File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 41, in run_all
run_patch(patch)
File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 30, in run_patch
if not run_single(patchmodule = patch):
File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 71, in run_single
return execute_patch(patchmodule, method, methodargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 91, in execute_patch
frappe.get_attr(patchmodule.split()[0] + ".execute")()
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v13_0/delete_old_purchase_reports.py", line 17, in execute
frappe.delete_doc("Report", report)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 871, in delete_doc
ignore_permissions, flags, ignore_on_trash, ignore_missing, delete_permanently)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/delete_doc.py", line 105, in delete_doc
check_if_doc_is_linked(doc)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/delete_doc.py", line 253, in check_if_doc_is_linked
raise_link_exists_exception(doc, linked_doctype, reference_docname)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/delete_doc.py", line 308, in raise_link_exists_exception
.format(doc.doctype, doc_link, reference_doctype, reference_link, row), frappe.LinkExistsError)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 424, in throw
msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 403, in msgprint
_raise_exception()
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 357, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.LinkExistsError: Cannot delete or cancel because Report <a href="/app/Form/Report/Purchase Order Items To Be Received or Billed">Purchase Order Items To Be Received or Billed</a> is linked with Prepared Report <a href="/app/Form/Prepared Report/REP00666">REP00666</a>
Any idea how this can be solved?
I tried to look through the ‘Report’ doctype for any ‘REP00666’ through bench console
but there is no such report in the list. The site too is not accessible now.
I attempted to delete ‘Purchase Order Items To Be Received or Billed’ as well through bench console
- frappe.delete_doc
- but being a standard report, I cannot delete that either.
So, any hints what I can do on this?