import xhiveframework


def execute():
	xhiveframework.reload_doc("HR", "doctype", "Leave Allocation")
	xhiveframework.reload_doc("HR", "doctype", "Leave Ledger Entry")
	xhiveframework.db.sql(
		"""
		UPDATE `tabLeave Ledger Entry` as lle
		SET company = (select company from `tabEmployee` where employee = lle.employee)
		WHERE company IS NULL
		"""
	)
	xhiveframework.db.sql(
		"""
		UPDATE `tabLeave Allocation` as la
		SET company = (select company from `tabEmployee` where employee = la.employee)
		WHERE company IS NULL
		"""
	)
