fix: Add cost center in loan document

(cherry picked from commit 5d66cc4c4a)

# Conflicts:
#	erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py
#	erpnext/patches.txt
This commit is contained in:
Deepesh Garg
2022-03-10 12:22:37 +05:30
committed by Mergify
parent 8cb85fa90b
commit c19dfbe98a
5 changed files with 79 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
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()