[fix] [hot] leave allocation patch
This commit is contained in:
parent
a5007db902
commit
c14f80838b
@ -2,14 +2,15 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
for leave_allocation in frappe.db.sql("select name, fiscal_year from `tabLeave Allocation`", as_dict=True):
|
if frappe.db.has_column("Leave Allocation", "fiscal_year"):
|
||||||
year_start_date, year_end_date = frappe.db.get_value("Fiscal Year", leave_allocation["fiscal_year"],
|
for leave_allocation in frappe.db.sql("select name, fiscal_year from `tabLeave Allocation`", as_dict=True):
|
||||||
["year_start_date", "year_end_date"])
|
dates = frappe.db.get_value("Fiscal Year", leave_allocation["fiscal_year"],
|
||||||
|
["year_start_date", "year_end_date"])
|
||||||
|
|
||||||
frappe.db.sql("""update `tabLeave Allocation`
|
if dates:
|
||||||
set from_date=%s, to_date=%s where name=%s""",
|
year_start_date, year_end_date = dates
|
||||||
(year_start_date, year_end_date, leave_allocation["name"]))
|
|
||||||
|
|
||||||
frappe.db.commit()
|
|
||||||
|
|
||||||
|
frappe.db.sql("""update `tabLeave Allocation`
|
||||||
|
set from_date=%s, to_date=%s where name=%s""",
|
||||||
|
(year_start_date, year_end_date, leave_allocation["name"]))
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user