brotherton-erpnext/erpnext/patches/v13_0/add_cost_center_in_loans.py
2022-03-28 18:52:46 +05:30

13 lines
371 B
Python

import frappe
def execute():
frappe.reload_doc("loan_management", "doctype", "loan")
loan = frappe.qb.DocType("Loan")
for company in frappe.get_all("Company", pluck="name"):
default_cost_center = frappe.db.get_value("Company", company, "cost_center")
frappe.qb.update(loan).set(loan.cost_center, default_cost_center).where(
loan.company == company
).run()