refactor: to avoid using SQL query to get fiscal year filters
This commit is contained in:
parent
3b1be2b1de
commit
69c5d49b25
@ -116,12 +116,8 @@ def auto_create_fiscal_year():
|
||||
pass
|
||||
|
||||
def get_from_and_to_date(fiscal_year):
|
||||
from_and_to_date_tuple = frappe.db.sql("""select year_start_date, year_end_date
|
||||
from `tabFiscal Year` where name=%s""", (fiscal_year))[0]
|
||||
|
||||
from_and_to_date = {
|
||||
"from_date": from_and_to_date_tuple[0],
|
||||
"to_date": from_and_to_date_tuple[1]
|
||||
}
|
||||
|
||||
return from_and_to_date
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user