From 89d109e8d23a58187f4aaa04a7b015dcfdaaa5f5 Mon Sep 17 00:00:00 2001 From: Gughan Ravikumar Date: Thu, 27 Jul 2023 23:12:11 +0530 Subject: [PATCH 1/2] fix: Naming Series preview when no previous transaction present --- erpnext/accounts/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index e354663151..9102e0a0ba 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -1112,7 +1112,12 @@ def get_autoname_with_number(number_value, doc_title, company): 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] From cdf100d55260044c1deeaacb2903788015e9395f Mon Sep 17 00:00:00 2001 From: Gughan Ravikumar Date: Tue, 15 Aug 2023 09:38:29 +0530 Subject: [PATCH 2/2] fix: Naming Series preview when no previous transaction present --- 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 9102e0a0ba..80e54cbc58 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -1118,7 +1118,7 @@ def parse_naming_series_variable(doc, variable): else: date = getdate() company = None - return get_fiscal_year(date=date, company=doc.get("company"))[0] + return get_fiscal_year(date=date, company=company)[0] @frappe.whitelist()