Merge pull request #36364 from SvbZ3r0/develop

fix: Naming Series preview when no previous transaction present
This commit is contained in:
Deepesh Garg 2023-09-13 15:17:51 +05:30 committed by GitHub
commit 7bfd487b25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1163,8 +1163,13 @@ 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()
return get_fiscal_year(date=date, company=doc.get("company"))[0]
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=company)[0]
@frappe.whitelist()