TypeError: cannot unpack non-iterable NoneType object

App Versions

{
	"datavalue_theme_15": "1.3.1",
	"erpnext": "15.28.0",
	"frappe": "15.31.0"
}

Route

Form/Sales Invoice/new-sales-invoice-countvikmz

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 49, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1768, 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/erpnext/stock/get_item_details.py", line 116, in get_item_details
    bin_details = get_bin_details(args.item_code, out.warehouse, include_child_warehouses=True)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/erpnext/erpnext/stock/get_item_details.py", line 1149, in get_bin_details
    warehouses = get_child_warehouses(warehouse) if include_child_warehouses else [warehouse]
  File "apps/erpnext/erpnext/stock/doctype/warehouse/warehouse.py", line 218, in get_child_warehouses
    children = get_descendants_of("Warehouse", warehouse, ignore_permissions=True, order_by="lft")
  File "apps/frappe/frappe/utils/nestedset.py", line 390, in get_descendants_of
    lft, rgt = frappe.db.get_value(doctype, name, ["lft", "rgt"])
TypeError: cannot unpack non-iterable NoneType object

Request Data

{
	"type": "POST",
	"args": {
		"doc": "{\"docstatus\":0,\"doctype\":\"Sales Invoice\",\"name\":\"new-sales-invoice-countvikmz\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"admin@gmail.com\",\"naming_series\":\"ACC-SINV-.YYYY.-\",\"company\":\"Nilestroom Enterprises\",\"posting_date\":\"2024-09-26\",\"set_posting_time\":0,\"custom_terms_of_sales\":\"COD\",\"is_pos\":0,\"is_consolidated\":0,\"is_return\":0,\"update_outstanding_for_self\":1,\"update_billed_amount_in_sales_order\":0,\"update_billed_amount_in_delivery_note\":1,\"is_debit_note\":0,\"custom_name_of_company\":\"Nilestroom Enterprises\",\"custom_company_address_line1\":\"Bay 5 , 17  Conald Road\",\"custom_company_address_line_2\":\"Harare , Zimbabwe\",\"custom_contact_no\":\"+263771789369/0125896544\",\"currency\":\"USD\",\"selling_price_list\":\"Standard Selling\",\"price_list_currency\":\"USD\",\"ignore_pricing_rule\":0,\"update_stock\":1,\"set_warehouse\":\"Stores - Live\",\"items\":[{\"docstatus\":0,\"doctype\":\"Sales Invoice Item\",\"name\":\"new-sales-invoice-item-qstdchkaxu\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"admin@gmail.com\",\"has_item_scanned\":0,\"stock_uom\":\"Nos\",\"margin_type\":\"\",\"is_free_item\":0,\"grant_commission\":1,\"delivered_by_supplier\":0,\"is_fixed_asset\":0,\"enable_deferred_revenue\":0,\"use_serial_batch_fields\":1,\"allow_zero_valuation_rate\":0,\"page_break\":0,\"parent\":\"new-sales-invoice-countvikmz\",\"parentfield\":\"items\",\"parenttype\":\"Sales Invoice\",\"idx\":1,\"warehouse\":\"Stores - Live\",\"qty\":0,\"conversion_factor\":0,\"stock_qty\":0,\"price_list_rate\":0,\"base_price_list_rate\":0,\"margin_rate_or_amount\":0,\"rate_with_margin\":0,\"discount_amount\":0,\"base_rate_with_margin\":0,\"rate\":0,\"amount\":0,\"base_rate\":0,\"base_amount\":0,\"stock_uom_rate\":0,\"net_rate\":0,\"net_amount\":0,\"base_net_rate\":0,\"base_net_amount\":0,\"weight_per_unit\":0,\"total_weight\":0,\"incoming_rate\":0,\"actual_batch_qty\":0,\"actual_qty\":0,\"delivered_qty\":0,\"item_code\":\"18.9LTS Dispenser bottle refill\",\"weight_uom\":\"\",\"barcode\":null,\"pricing_rules\":\"\"}],\"taxes\":[{\"docstatus\":0,\"doctype\":\"Sales Taxes and Charges\",\"name\":\"new-sales-taxes-and-charges-mceebresyw\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"admin@gmail.com\",\"charge_type\":\"On Net Total\",\"included_in_print_rate\":1,\"included_in_paid_amount\":0,\"cost_center\":\"Main - NE\",\"account_currency\":null,\"dont_recompute_tax\":0,\"parent\":\"new-sales-invoice-countvikmz\",\"parentfield\":\"taxes\",\"parenttype\":\"Sales Invoice\",\"idx\":1,\"row_id\":null,\"account_head\":\"VAT - NE\",\"description\":\"VAT @ 15.0\",\"rate\":0,\"tax_amount\":0,\"total\":0,\"tax_amount_after_discount_amount\":0,\"base_tax_amount\":0,\"base_total\":0,\"base_tax_amount_after_discount_amount\":0,\"item_wise_tax_detail\":\"{\\\"undefined\\\":[0,0]}\"}],\"use_company_roundoff_cost_center\":0,\"disable_rounded_total\":0,\"apply_discount_on\":\"Grand Total\",\"is_cash_or_non_trade_discount\":0,\"pricing_rules\":[],\"packed_items\":[],\"timesheets\":[],\"total_billing_amount\":0,\"payments\":[],\"allocate_advances_automatically\":0,\"only_include_allocated_payments\":0,\"advances\":[],\"write_off_outstanding_amount_automatically\":0,\"redeem_loyalty_points\":0,\"territory\":\"Zimbabwe\",\"ignore_default_payment_terms_template\":0,\"payment_schedule\":[],\"tc_name\":\"Terms\",\"party_account_currency\":\"USD\",\"is_opening\":\"No\",\"sales_team\":[],\"group_same_items\":1,\"status\":\"Draft\",\"customer_group\":\"Commercial\",\"is_internal_customer\":0,\"is_discounted\":0,\"repost_required\":0,\"posting_time\":\"15:56:29\",\"conversion_rate\":1,\"plc_conversion_rate\":1,\"total_billing_hours\":0,\"terms\":\"<div class=\\\"ql-editor read-mode\\\"><p><strong>Banking Details</strong></p><p>Bank : CBZ</p><p>Branch : Borrowdale</p><p>Account : 02923142490033 (Nostro)</p><p>Account : 02923142490013 (ZWG)</p><p><br></p><p><br></p><p><strong style=\\\"font-size: 8px;\\\">Notes :</strong></p><p><strong style=\\\"font-size: 8px;\\\">Thanks for doing business with us</strong></p><p><strong style=\\\"font-size: 8px;\\\">Authorized Signature&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Receiver </strong></p><p><strong style=\\\"font-size: 8px;\\\">--------------------------------------&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;......................................................................</strong></p></div>\",\"company_address\":null,\"company_address_display\":null,\"taxes_and_charges\":\"Zimbabwe Tax - NE\",\"base_net_total\":0,\"net_total\":0,\"base_total\":0,\"total\":0,\"total_qty\":0,\"rounding_adjustment\":0,\"grand_total\":0,\"base_grand_total\":0,\"total_taxes_and_charges\":0,\"base_total_taxes_and_charges\":0,\"base_rounding_adjustment\":0,\"rounded_total\":0,\"base_rounded_total\":0,\"in_words\":\"\",\"base_in_words\":\"\",\"base_discount_amount\":0,\"total_advance\":0,\"write_off_amount\":0,\"paid_amount\":0,\"base_paid_amount\":0,\"change_amount\":0,\"base_change_amount\":0,\"outstanding_amount\":0,\"amount_eligible_for_commission\":0,\"total_commission\":null,\"tax_id\":null,\"customer_name\":\"AMC NISSAN\",\"custom_customer_tin\":\"2000686382\",\"custom_customer_vat_no\":\"220169606\",\"custom_customer_location\":\"DOUGLAS ROAD,WORKINGTON ,\",\"custom_customer_location_1\":\"Harare\",\"custom_customer_location_2\":null,\"loyalty_program\":null,\"represents_company\":null,\"customer\":\"AMC NISSAN\",\"debit_to\":\"1310 - Debtors - NE\",\"due_date\":\"2024-09-26\",\"customer_address\":null,\"address_display\":null,\"shipping_address_name\":null,\"shipping_address\":null,\"tax_category\":\"\",\"contact_person\":null,\"contact_display\":null,\"contact_email\":null,\"contact_mobile\":null,\"language\":\"en\",\"payment_terms_template\":null}",
		"args": "{\"item_code\":\"18.9LTS Dispenser bottle refill\",\"barcode\":null,\"set_warehouse\":\"Stores - Live\",\"warehouse\":\"Stores - Live\",\"customer\":\"AMC NISSAN\",\"currency\":\"USD\",\"update_stock\":1,\"conversion_rate\":1,\"price_list\":\"Standard Selling\",\"price_list_currency\":\"USD\",\"plc_conversion_rate\":1,\"company\":\"Nilestroom Enterprises\",\"is_pos\":0,\"is_return\":0,\"ignore_pricing_rule\":0,\"doctype\":\"Sales Invoice\",\"name\":\"new-sales-invoice-countvikmz\",\"qty\":1,\"net_rate\":0,\"base_net_rate\":0,\"stock_qty\":0,\"conversion_factor\":0,\"weight_per_unit\":0,\"weight_uom\":\"\",\"stock_uom\":\"Nos\",\"pos_profile\":\"\",\"tax_category\":\"\",\"child_doctype\":\"Sales Invoice Item\",\"child_docname\":\"new-sales-invoice-item-qstdchkaxu\"}"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/erpnext.stock.get_item_details.get_item_details",
	"request_id": null
}

Response Data

{
	"exception": "TypeError: cannot unpack non-iterable NoneType object",
	"exc_type": "TypeError",
	"_exc_source": "erpnext (app)"
}