2018-04-24 06:49:36 +00:00
|
|
|
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
|
|
|
// For license information, please see license.txt
|
|
|
|
|
|
|
|
frappe.ui.form.on(cur_frm.doctype, {
|
|
|
|
refresh: function(frm) {
|
|
|
|
if (!frappe.boot.active_domains.includes("Non Profit")) {
|
2020-02-27 07:46:53 +00:00
|
|
|
frm.set_df_property('applicant_type', 'options', ['Employee', 'Customer']);
|
2018-04-24 06:49:36 +00:00
|
|
|
frm.refresh_field('applicant_type');
|
|
|
|
}
|
2020-02-27 07:46:53 +00:00
|
|
|
|
|
|
|
if (['Loan Disbursement', 'Loan Repayment', 'Loan Interest Accrual'].includes(frm.doc.doctype)
|
|
|
|
&& frm.doc.docstatus == 1) {
|
|
|
|
|
|
|
|
frm.add_custom_button(__("Accounting Ledger"), function() {
|
|
|
|
frappe.route_options = {
|
|
|
|
voucher_no: frm.doc.name,
|
|
|
|
company: frm.doc.company
|
|
|
|
};
|
|
|
|
|
|
|
|
frappe.set_route("query-report", "General Ledger");
|
|
|
|
},__("View"));
|
|
|
|
}
|
2018-04-24 06:49:36 +00:00
|
|
|
},
|
|
|
|
applicant: function(frm) {
|
2020-02-27 07:46:53 +00:00
|
|
|
if (!["Loan Application", "Loan"].includes(frm.doc.doctype)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-04-24 06:49:36 +00:00
|
|
|
if (frm.doc.applicant) {
|
|
|
|
frappe.model.with_doc(frm.doc.applicant_type, frm.doc.applicant, function() {
|
|
|
|
var applicant = frappe.model.get_doc(frm.doc.applicant_type, frm.doc.applicant);
|
|
|
|
frm.set_value("applicant_name",
|
|
|
|
applicant.employee_name || applicant.member_name);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
frm.set_value("applicant_name", null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|