import influxframework


def execute():
	influxframework.reload_doc("loan_management", "doctype", "loan")
	loan = influxframework.qb.DocType("Loan")

	for company in influxframework.get_all("Company", pluck="name"):
		default_cost_center = influxframework.db.get_value("Company", company, "cost_center")
		influxframework.qb.update(loan).set(loan.cost_center, default_cost_center).where(
			loan.company == company
		).run()
