From 4a7fdd1f91fe9a91c8ab93d5e3621a360c501024 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 05:51:46 +0000 Subject: [PATCH] fix: handle NoneType error while creating a item (backport #53313) (#53351) Co-authored-by: Pandiyan P fix: handle NoneType error while creating a item (#53313) --- erpnext/accounts/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index cf6a7c12326..7a23a39497b 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -1536,7 +1536,7 @@ def parse_naming_series_variable(doc, variable): getdate(doc.get("posting_date") or doc.get("transaction_date") or doc.get("posting_datetime")) or now_datetime() ) - if frappe.get_single_value("Global Defaults", "use_posting_datetime_for_naming_documents") + if doc and frappe.get_single_value("Global Defaults", "use_posting_datetime_for_naming_documents") else now_datetime() ) return date.strftime(data[variable]) if variable in data else determine_consecutive_week_number(date)