fix: Naming Series preview when no previous transaction present

This commit is contained in:
Gughan Ravikumar 2023-07-27 23:12:11 +05:30
parent 829387c2bc
commit 89d109e8d2

View File

@ -1112,7 +1112,12 @@ def get_autoname_with_number(number_value, doc_title, company):
def parse_naming_series_variable(doc, variable): def parse_naming_series_variable(doc, variable):
if variable == "FY": 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] return get_fiscal_year(date=date, company=doc.get("company"))[0]