fix: replace sql code with fields list in get_cached_value

(cherry picked from commit 19db7e2989)
This commit is contained in:
ruthra kumar
2022-12-06 13:42:33 +05:30
parent 84ef814f45
commit b3ccad8cf4

View File

@@ -169,5 +169,6 @@ def auto_create_fiscal_year():
def get_from_and_to_date(fiscal_year):
fields = ["year_start_date as from_date", "year_end_date as to_date"]
return frappe.db.get_value("Fiscal Year", fiscal_year, fields, as_dict=1)
fields = ["year_start_date", "year_end_date"]
cached_results = frappe.get_cached_value("Fiscal Year", fiscal_year, fields, as_dict=1)
return dict(from_date=cached_results.year_start_date, to_date=cached_results.year_end_date)