Try ERPNext Buy Support Partners Foundation

Error bench update from version 12 to version 13 beta

Hi, I am getting below error , after I restore 12 database and running
bench update --patch

Executing erpnext.patches.v12_0.set_purchase_receipt_delivery_note_detail in demo.xxxxx.com (xxxxx)
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 “/srv/bench/erp12temp/apps/frappe/frappe/utils/bench_helper.py”, line 99, in
main()
File “/srv/bench/erp12temp/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/srv/bench/erp12temp/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/srv/bench/erp12temp/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/srv/bench/erp12temp/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/srv/bench/erp12temp/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/srv/bench/erp12temp/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/srv/bench/erp12temp/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/srv/bench/erp12temp/env/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/srv/bench/erp12temp/apps/frappe/frappe/commands/ init .py”, line 26, in func
ret = f(frappe. dict(ctx.obj), *args, **kwargs)
File “/srv/bench/erp12temp/apps/frappe/frappe/commands/site.py”, line 265, in migrate
migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
File “/srv/bench/erp12temp/apps/frappe/frappe/migrate.py”, line 67, in migrate
frappe.modules.patch_handler.run_all(skip_failing)
File “/srv/bench/erp12temp/apps/frappe/frappe/modules/patch_handler.py”, line 41, in run_all
run_patch(patch)
File “/srv/bench/erp12temp/apps/frappe/frappe/modules/patch_handler.py”, line 30, in run_patch
if not run_single(patchmodule = patch):
File “/srv/bench/erp12temp/apps/frappe/frappe/modules/patch_handler.py”, line 71, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/srv/bench/erp12temp/apps/frappe/frappe/modules/patch_handler.py”, line 91, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/srv/bench/erp12temp/apps/erpnext/erpnext/patches/v12_0/set_purchase_receipt_delivery_note_detail.py”, line 91, in execute
set_document_detail_in_return_document(“Delivery Note”)
File “/srv/bench/erp12temp/apps/erpnext/erpnext/patches/v12_0/set_purchase_receipt_delivery_note_detail.py”, line 71, in set_document_detail_in_return_document
doc_items = frappe.get_cached_doc(doctype, docname).get(“items”)
File “/srv/bench/erp12temp/apps/frappe/frappe/ init .py”, line 728, in get_cached_doc
doc = get_doc(*args, **kwargs)
File “/srv/bench/erp12temp/apps/frappe/frappe/ init .py”, line 771, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/srv/bench/erp12temp/apps/frappe/frappe/model/document.py”, line 71, in get_doc
return controller(*args, **kwargs)
File “/srv/bench/erp12temp/apps/erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py”, line 25, in init
super(DeliveryNote, self). init (*args, **kwargs)
File “/srv/bench/erp12temp/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 29, in init
super(AccountsController, self). init (*args, **kwargs)
File “/srv/bench/erp12temp/apps/frappe/frappe/model/document.py”, line 106, in init
self.load_from_db()
File “/srv/bench/erp12temp/apps/frappe/frappe/model/document.py”, line 149, in load_from_db
frappe.throw(
("{0} {1} not found").format(
(self.doctype), self.name), frappe.DoesNotExistError)
File “/srv/bench/erp12temp/apps/frappe/frappe/ init .py”, line 396, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable)
File “/srv/bench/erp12temp/apps/frappe/frappe/ init .py”, line 375, in msgprint
_raise_exception()
File “/srv/bench/erp12temp/apps/frappe/frappe/ init .py”, line 326, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.DoesNotExistError: Delivery Note not found

bench switch-to-branch version-13-beta frappe erpnext
bench update --patch
bench setup requirements
bench update migrate
bench restart

Did the same earlier. Does not work.
What could be the problem ?

This was related to some junk test entry for which delivery note did not exist.
Removed related transaction and problem resolved.
Thanks