refactor: to avoid using SQL query to get fiscal year filters

This commit is contained in:
Anuja P 2020-12-03 15:14:54 +05:30
parent 3b1be2b1de
commit 69c5d49b25

View File

@ -116,12 +116,8 @@ def auto_create_fiscal_year():
pass pass
def get_from_and_to_date(fiscal_year): def get_from_and_to_date(fiscal_year):
from_and_to_date_tuple = frappe.db.sql("""select year_start_date, year_end_date fields = [
from `tabFiscal Year` where name=%s""", (fiscal_year))[0] "year_start_date as from_date",
"year_end_date as to_date"
from_and_to_date = { ]
"from_date": from_and_to_date_tuple[0], return frappe.db.get_value("Fiscal Year", fiscal_year, fields, as_dict=1)
"to_date": from_and_to_date_tuple[1]
}
return from_and_to_date