fix: Allow creation of loan security pledge from Loan Application for old prices
This commit is contained in:
parent
5239c0e6d5
commit
2daf6dad2e
@ -31,7 +31,7 @@ frappe.ui.form.on('Loan Application', {
|
||||
add_toolbar_buttons: function(frm) {
|
||||
if (frm.doc.status == "Approved") {
|
||||
|
||||
if (frm.doc.is_secured) {
|
||||
if (frm.doc.is_secured_loan) {
|
||||
frappe.db.get_value("Loan Security Pledge", {"loan_application": frm.doc.name, "docstatus": 1}, "name", (r) => {
|
||||
if (!r) {
|
||||
frm.add_custom_button(__('Loan Security Pledge'), function() {
|
||||
|
@ -30,7 +30,8 @@ class LoanSecurityPledge(Document):
|
||||
if not pledge.qty and not pledge.amount:
|
||||
frappe.throw(_("Qty or Amount is mandatroy for loan security"))
|
||||
|
||||
pledge.loan_security_price = get_loan_security_price(pledge.loan_security)
|
||||
if not (self.loan_application and pledge.loan_security_price):
|
||||
pledge.loan_security_price = get_loan_security_price(pledge.loan_security)
|
||||
|
||||
if not pledge.qty:
|
||||
pledge.qty = cint(pledge.amount/pledge.loan_security_price)
|
||||
|
@ -37,7 +37,7 @@ def get_loan_security_price(loan_security, valid_time=None):
|
||||
}, 'loan_security_price')
|
||||
|
||||
if not loan_security_price:
|
||||
frappe.throw(_("No valid <b>Loan Security Price</b> found for {0}").format(frappe.bold(loan_security)))
|
||||
frappe.throw(_("No valid Loan Security Price found for {0}").format(frappe.bold(loan_security)))
|
||||
else:
|
||||
return loan_security_price
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user