Unable to create Sales Order from Sales Quotation (Customer returned as NoneType object)


I’ve updated my ERPNext -14 version to latest release and started experiencing errors while creating Sales Order from Sales Quoation.

Below is the error log:

App Versions

	"erpnext": "14.24.3",
	"erpnext_telegram_integration": "1.2.0",
	"frappe": "14.36.1",
	"hrms": "14.3.2",
	"india_compliance": "14.7.0",
	"payments": "0.0.1",
	"posawesome": "3.5.1"




Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 66, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 45, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 83, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1607, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/model/mapper.py", line 36, in make_mapped_doc
    return method(source_name)
  File "apps/erpnext/erpnext/selling/doctype/quotation/quotation.py", line 263, in make_sales_order
    return _make_sales_order(source_name, target_doc)
  File "apps/erpnext/erpnext/selling/doctype/quotation/quotation.py", line 333, in _make_sales_order
    doclist = get_mapped_doc(
  File "apps/frappe/frappe/model/mapper.py", line 144, in get_mapped_doc
    postprocess(source_doc, target_doc)
  File "apps/erpnext/erpnext/selling/doctype/quotation/quotation.py", line 291, in set_missing_values
    for d in customer.get("sales_team"):
TypeError: 'NoneType' object is not iterable

Request Data

	"type": "POST",
	"args": {
		"method": "erpnext.selling.doctype.quotation.quotation.make_sales_order",
		"source_name": "SAL-QTN-2023-01916-1",
		"args": null,
		"selected_children": "{}"
	"freeze": true,
	"freeze_message": "",
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.model.mapper.make_mapped_doc"

Response Data

	"exception": "TypeError: 'NoneType' object is not iterable"

As we can see in the error log that erpnext.selling.doctype.quotation.quotation.make_sales_order method is trying to iterate through the Customer Sales Team and couldn’t find anyone and throwing error. I didn’t face this issue before the update. Can someone help me fix this bug?

Thanks in advance.
Vinod Kumar K

I guess the issue of ‘NoneType’ object is not with Sales Team but with Customer. Somehow the customer is returned as ‘NoneType’ eventhough the Quotation is raised with “A Lead that has linked with Customer”. But as the case, I don’t know why Customer is returned as None eventhough the Lead of Quotation has Customer linked with.

Vinod Kumar K

Hi @VinodKumarkolli,

This problem has been fixed.

So will solve your problem in the upcoming update.

Thank You!

Thanks @NCP for the information :grinning::grinning:

Vinod Kumar K