Cannot Print the Shipping Label | ERPNext Shipping 15

I am using the ERPNext Shipping module, and after creating a Delivery Note, I want to link the order with a shipping service. I am able to create a Shipment Order successfully, but I encounter an error when trying to Print the Shipping Label.

Has anyone faced this issue before? Any guidance on how to resolve it would be appreciated.

ERROR

Server Error

UnboundLocalError: cannot access local variable ‘shipping_label’ where it is not associated with a value
Possible source of error: erpnext_shipping (app)

Furthermore, here is the detail of this error:

App Versions

{
	"erpnext": "15.52.0",
	"erpnext_shipping": "15.0.3",
	"frappe": "15.56.1",
}

Route

Form/Shipment/SHIPMENT-00002

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 50, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1726, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext_shipping/erpnext_shipping/erpnext_shipping/shipping.py", line 197, in print_shipping_label
    return shipping_label
           ^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'shipping_label' where it is not associated with a value

Request Data

{
	"type": "POST",
	"args": {
		"shipment": "SHIPMENT-00002"
	},
	"freeze": true,
	"freeze_message": "Printing Shipping Label",
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/erpnext_shipping.erpnext_shipping.shipping.print_shipping_label",
	"request_id": null
}

Response Data

{
	"exception": "UnboundLocalError: cannot access local variable 'shipping_label' where it is not associated with a value",
	"exc_type": "UnboundLocalError",
	"_exc_source": "erpnext_shipping (app)"
}

Which provider are you using? ERPNext Shipping app label generation varies by the shipping provider.

@volkswagner, First of all, thank you for your prompt and helpful responses, as always.

My client manages shipments independently rather than using UPS, DHL, or FedEx, so there is no integration with shipping or courier services. I initially assumed that the Print Shipping Label was simply a customizable print format or report, but it seems my understanding was incorrect.

I haven’t been able to find much detailed information about the ERPNext Shipping module. If anyone could provide a reference to comprehensive documentation, I would greatly appreciate it.

You probably don’t need erpnext_shipping if you have no intention of integrating LetMeShip or SendCloud.

You’ll need a custom doctype to handle the shipping label. You could also consider creating a custom print format for Shipment doctype for the label.

Typically label printers like .png, pdf, or .zpl format. Maybe you can utilize a 4x6 pdf in custom print format and use the PDF function.

1 Like