[fixes] fix grand total calculation for Payment Request and set visibility of Resend Payment Email button
This commit is contained in:
parent
3a2682919a
commit
1864879b91
@ -16,18 +16,20 @@ frappe.ui.form.on("Payment Request", "onload", function(frm, dt, dn){
|
||||
})
|
||||
|
||||
frappe.ui.form.on("Payment Request", "refresh", function(frm) {
|
||||
frm.add_custom_button(__('Resend Payment Email'), function(){
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.payment_request.payment_request.resend_payment_email",
|
||||
args: {"docname": frm.doc.name},
|
||||
freeze: true,
|
||||
freeze_message: __("Sending"),
|
||||
callback: function(r){
|
||||
if(!r.exc) {
|
||||
frappe.msgprint(__("Message Sent"));
|
||||
if(!in_list(["Initiated", "Paid"], frm.doc.status) && !frm.doc.__islocal){
|
||||
frm.add_custom_button(__('Resend Payment Email'), function(){
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.payment_request.payment_request.resend_payment_email",
|
||||
args: {"docname": frm.doc.name},
|
||||
freeze: true,
|
||||
freeze_message: __("Sending"),
|
||||
callback: function(r){
|
||||
if(!r.exc) {
|
||||
frappe.msgprint(__("Message Sent"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -209,11 +209,11 @@ def get_amount(ref_doc, dt):
|
||||
"""get amount based on doctype"""
|
||||
if dt == "Sales Order":
|
||||
base_grand_total = flt(ref_doc.base_grand_total)
|
||||
grand_total = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid)
|
||||
grand_total = flt(ref_doc.base_grand_total) - flt(ref_doc.advance_paid) / flt(ref_doc.conversion_rate)
|
||||
|
||||
if dt == "Sales Invoice":
|
||||
base_grand_total = flt(ref_doc.base_grand_total)
|
||||
grand_total = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid)
|
||||
grand_total = flt(ref_doc.base_grand_total) - flt(ref_doc.outstanding_amount) / flt(ref_doc.conversion_rate)
|
||||
|
||||
if base_grand_total > 0 and grand_total > 0 :
|
||||
return base_grand_total, grand_total
|
||||
|
Loading…
x
Reference in New Issue
Block a user