Issue while migrating / update

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 104, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 19, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1259, 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 1259, 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 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py”, line 21, 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 309, 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/update_returned_qty_in_pr_dn.py”, line 27, in execute
update_from_return_docs(doctype)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py”, line 17, in update_from_return_docs
return_doc.update_prevdoc_status()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/status_updater.py”, line 119, in update_prevdoc_status
self.update_qty()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/status_updater.py”, line 253, in update_qty
self._update_percent_field_in_targets(args, update_modified)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/status_updater.py”, line 300, in _update_percent_field_in_targets
self.update_percent_field(args, update_modified)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/status_updater.py”, line 334, in update_percent_field
target = frappe.get_doc(args[“target_parent_dt”], args[“name”])
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 850, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 75, in get_doc
return controller(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py”, line 28, in init
super(PurchaseReceipt, self).init(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 34, in init
super(AccountsController, self).init(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 113, in init
self.load_from_db()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 156, in load_from_db
frappe.throw(
(“{0} {1} not found”).format(
(self.doctype), self.name), frappe.DoesNotExistError)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 432, 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 411, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 365, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.DoesNotExistError: Purchase Receipt None not found

Hi,

It may help to say the operation environment, version of frappe/ERPNext and the commands used to attempt the update. Is this the first time an update was tried or has it been updated successfully before this?

I’m getting the same error except: Delivery Note None not found

I think the problem is that both of us have credit notes in Purchase Receipt, and Delivery Note that are not referencing the original doc. Most likely from a data import. I’m looking into how to get around this

Making these changes worked for me.
https://github.com/dj12djdjs/erpnext/commit/d3a4a157823ceb1e5c28adf74b4db6054b14b71b

erpnext 13.9.2
frappe 13.9.0
ubuntu 18.04

After making the changes.
Step1: bench --site site_name migrate
Step2: bench update --reset

1 Like