Skip to content

Commit

Permalink
fix: replace sql code with fields list in get_cached_value
Browse files Browse the repository at this point in the history
(cherry picked from commit 19db7e2)
  • Loading branch information
ruthra-kumar committed Dec 6, 2022
1 parent 08bca7d commit e18d0ec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions erpnext/accounts/doctype/fiscal_year/fiscal_year.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit e18d0ec

Please sign in to comment.