Error during Purchase Receipts and Delivery Note

I am facing this error, while creating the purchase receipt or delivery note for Stock Item,

TypeError: cannot unpack non-iterable NoneType object
Possible source of error: erpnext (app)

What could be the issue? Version 15.

We checked recently so It worked fine!

Which version do you use in the version 15?

ERPNext: v15.28.0

Frappe Framework: v15.32.0

I have 2 instances, both of same versions, same configuration, but currently facing issue on 1 instance

Share the full error. open the console log and share it.

### App Versions

{
“erpnext”: “15.28.0”,
“frappe”: “15.32.0”,

}

### Route

Form/Delivery Note/MAT-DN-2024-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 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/frappe/frappe/desk/form/save.py”, line 37, in savedocs
doc.submit()
File “apps/frappe/frappe/utils/typing_validations.py”, line 31, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 1048, in submit
return self._submit()
^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 1031, in _submit
return self.save()
^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 337, in save
return self._save(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 390, in _save
self.run_post_save_methods()
File “apps/frappe/frappe/model/document.py”, line 1131, in run_post_save_methods
self.run_method(“on_submit”)
File “apps/frappe/frappe/model/document.py”, line 962, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 1322, in composer
return composed(self, method, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 1304, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 959, in fn
return method_object(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/erpnext/erpnext/stock/doctype/delivery_note/delivery_note.py”, line 476, in on_submit
self.make_gl_entries()
File “apps/erpnext/erpnext/controllers/stock_controller.py”, line 124, in make_gl_entries
else self.get_gl_entries(warehouse_account)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/erpnext/erpnext/controllers/stock_controller.py”, line 493, in get_gl_entries
self.get_gl_dict(
File “apps/erpnext/erpnext/controllers/accounts_controller.py”, line 1008, in get_gl_dict
account_currency = get_account_currency(gl_dict.account)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/erpnext/erpnext/accounts/doctype/account/account.py”, line 448, in get_account_currency
return frappe.local_cache(“account_currency”, account, generator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/init.py”, line 2282, in local_cache
local.cache[namespace][key] = generator()
^^^^^^^^^^^
File “apps/erpnext/erpnext/accounts/doctype/account/account.py”, line 440, in generator
account_currency, company = frappe.get_cached_value(
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable NoneType object

### Request Data

{
“type”: “POST”,
“args”: {
“doc”: “{"name":"MAT-DN-2024-00002","owner":"abdullah.com","creation":"2024-07-15 12:36:46.400661","modified":"2024-07-15 12:36:59.299664","modified_by":"abdullah.com","docstatus":0,"idx":0,"title":"Ibrahim Abdulaziz Al-Muhammed","naming_series":"MAT-DN-.YYYY.-","customer":"120020799","customer_name":"Ibrahim Abdulaziz Al-Muhammed","customer_name_in_arabic":"ابراهيم عبدالعزيز المحميد","posting_date":"2024-07-15","posting_time":"12:36:59.360307","set_posting_time":0,"company":"Al-Butain","is_return":0,"issue_credit_note":0,"currency":"SAR","conversion_rate":1,"selling_price_list":"Standard Selling","price_list_currency":"SAR","plc_conversion_rate":1,"ignore_pricing_rule":0,"set_warehouse":"Finished Goods(FG01) - AACA","total_qty":3,"total_net_weight":0,"base_total":60,"base_net_total":60,"total":60,"net_total":60,"tax_category":"","taxes_and_charges":"KSA VAT 15% - AACA","base_total_taxes_and_charges":9,"total_taxes_and_charges":9,"base_grand_total":69,"base_rounding_adjustment":0,"base_rounded_total":0,"base_in_words":"","grand_total":69,"rounding_adjustment":0,"rounded_total":0,"in_words":"","disable_rounded_total":1,"apply_discount_on":"Grand Total","base_discount_amount":0,"additional_discount_percentage":0,"discount_amount":0,"other_charges_calculation":"<div class=\"tax-break-up\" style=\"overflow-x: auto;\">\n\t<table class=\"table table-bordered table-hover\">\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t<th class=\"text-left\">Item\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t<th class=\"text-right\">Taxable Amount\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t<th class=\"text-right\">VAT 15% @ 15.0\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t1001010010001\n\t\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t60.00\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t(15.0%)\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t9.00\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t\n","company_trn":"300472099100003","per_billed":0,"status":"Draft","per_installed":0,"installation_status":"Not Installed","per_returned":0,"lr_date":"2024-07-15","po_no":"","amount_eligible_for_commission":60,"commission_rate":0,"total_commission":0,"print_without_amount":0,"group_same_items":0,"language":"en","is_internal_customer":0,"customer_group":"BACA Customer Group","territory":"KSA","doctype":"Delivery Note","pricing_rules":,"taxes":[{"name":"2i6heujqaf","owner":"abdullah.com","creation":"2024-07-15 12:36:46.400661","modified":"2024-07-15 12:36:59.299664","modified_by":"abdullah.com","docstatus":0,"idx":1,"charge_type":"On Net Total","account_head":"VAT 15% - AACA","description":"VAT 15% @ 15.0","included_in_print_rate":0,"included_in_paid_amount":0,"cost_center":"400 - Administration - الأدارية - AACA","rate":15,"account_currency":"SAR","tax_amount":9,"total":69,"tax_amount_after_discount_amount":9,"base_tax_amount":9,"base_total":69,"base_tax_amount_after_discount_amount":9,"item_wise_tax_detail":"{\"1001010010001\":[15,9]}","dont_recompute_tax":0,"parent":"MAT-DN-2024-00002","parentfield":"taxes","parenttype":"Delivery Note","doctype":"Sales Taxes and Charges","__unsaved":1}],"packed_items":,"items":[{"name":"2i6hlidsig","owner":"abdullah.com","creation":"2024-07-15 12:36:46.400661","modified":"2024-07-15 12:36:59.299664","modified_by":"abdullah.com","docstatus":0,"idx":1,"barcode":"1001010010001","has_item_scanned":0,"item_code":"1001010010001","item_name":"PUMPKIN BULK SF","description":"PUMPKIN BULK SF","is_zero_rated":0,"is_exempt":0,"item_group":"001-Vegetables-SF","image":"","qty":3,"stock_uom":"KGS","uom":"KGS","conversion_factor":1,"stock_qty":3,"returned_qty":0,"price_list_rate":0,"base_price_list_rate":0,"margin_type":"","margin_rate_or_amount":0,"rate_with_margin":0,"discount_percentage":0,"discount_amount":0,"base_rate_with_margin":0,"rate":20,"amount":60,"base_rate":20,"base_amount":60,"stock_uom_rate":20,"is_free_item":0,"grant_commission":1,"net_rate":20,"net_amount":60,"base_net_rate":20,"base_net_amount":60,"billed_amt":0,"incoming_rate":0,"weight_per_unit":0,"total_weight":0,"warehouse":"Finished Goods(FG01) - AACA","allow_zero_valuation_rate":0,"against_sales_order":"SAL-ORD-2024-00002","so_detail":"2i1hqshikc","use_serial_batch_fields":0,"actual_batch_qty":0,"actual_qty":0,"installed_qty":0,"item_tax_rate":"{}","packed_qty":0,"received_qty":0,"expense_account":"5101 - Cost of goods sold - AACA","cost_center":"40147 - Warehouse - Maintenance - NO-5 مستودع - صيانة - رقم 5 - AACA","page_break":0,"parent":"MAT-DN-2024-00002","parentfield":"items","parenttype":"Delivery Note","doctype":"Delivery Note Item","__unsaved":1}],"sales_team":,"__onload":{"has_unpacked_items":true}}”,
“action”: “Submit”
},
“btn”: {
“jQuery3700204974752740784361”: {
“events”: {
“click”: [
{
“type”: “click”,
“origType”: “click”,
“guid”: 18104,
“namespace”: “”
}
]
}
}
},
“freeze”: true,
“headers”: {},
“error_handlers”: {},
“url”: “/api/method/frappe.desk.form.save.savedocs”,
“request_id”: null
}

### Response Data

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

account currency issue, so check the company currency and account currency.

we multiple time tested in below version but issue not found.

ERPNext: v15.29.3 (version-15)
Frappe Framework: v15.34.1 (version-15)

TypeError: cannot unpack non-iterable NoneType object
Possible source of error: erpnext (app)

Hi, Thanks for the replies and apologise I didnt came back to this post again before today,

Issue was basically related with account, that there was an account linked to one warehouse that was having trouble.
I had to reconfigure that account and issue was solved.