fix: Naming Series preview when no previous transaction present
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index e354663..9102e0a 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -1112,7 +1112,12 @@
def parse_naming_series_variable(doc, variable):
if variable == "FY":
- date = doc.get("posting_date") or doc.get("transaction_date") or getdate()
+ if doc:
+ date = doc.get("posting_date") or doc.get("transaction_date")
+ company = doc.get("company")
+ else:
+ date = getdate()
+ company = None
return get_fiscal_year(date=date, company=doc.get("company"))[0]