Merge pull request #36229 from deepeshgarg007/naming_in_order

fix: FY in naming series variable for orders
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 4b54483..e354663 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -1112,7 +1112,8 @@
 
 def parse_naming_series_variable(doc, variable):
 	if variable == "FY":
-		return get_fiscal_year(date=doc.get("posting_date"), company=doc.get("company"))[0]
+		date = doc.get("posting_date") or doc.get("transaction_date") or getdate()
+		return get_fiscal_year(date=date, company=doc.get("company"))[0]
 
 
 @frappe.whitelist()