brotherton-erpnext/erpnext/patches/v13_0/add_cost_center_in_loans.py
2022-03-10 12:22:37 +05:30

16 lines
384 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()