Patch Issue: AttributeError: 'DeliveryNote' object has no attribute 'is_return'

Hi good day :slight_smile:
I need to go forward to upgrade from v13 to v14 but I still have 1 patch that was not yet resolved during v13 upgrade. Anyone can help me please :slight_smile:

I am having error in this patch: erpnext.patches.v12_0.set_purchase_receipt_delivery_note_detail
Error Message:

Executing erpnext.patches.v12_0.set_purchase_receipt_delivery_note_detail in [site] (_0f663089722405bc)
Traceback (most recent call last):
  File "/usr/lib/python3.8/", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/", line 87, in _run_code
    exec(code, run_globals)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 104, in <module>
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 19, in main
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", line 782, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/", line 27, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/", line 306, in migrate
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 67, in migrate
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/", line 41, in run_all
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/", line 30, in run_patch
    if not run_single(patchmodule = patch):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/", line 71, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/", line 91, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v12_0/", line 94, in execute
    set_document_detail_in_return_document("Delivery Note")
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v12_0/", line 74, in set_document_detail_in_return_document
    doc_items = frappe.get_cached_doc(doctype, docname).get("items")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 834, in get_cached_doc
    doc = get_doc(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 877, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 75, in get_doc
    return controller(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/delivery_note/", line 57, in __init__
    if cint(self.is_return):
AttributeError: 'DeliveryNote' object has no attribute 'is_return'

I tried bench console
frappe.reload_doctype(‘Delivery Note’)

But still with same error message :frowning:

Use command bench --site sitename migrate --skip-failing

Hi @mohsininspire, thank you for your reply. I don’t want to skip this error. I need to fix it to proceed with v14.

bench --site sitename migrate --skip-failing

Then after use below command
bench --site sitename migrate

Hi @mohsininspire, same error message

Need to manual debug, it is in python memory but not yet in database:

Delivery Note PY File line 57:
From → if cint(self.is_return):
Change to → if cint(self.get(‘is_return’)):

Then run bench migrate again

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.