mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
[fixes] fix grand total calculation for Payment Request and set visibility of Resend Payment Email button
This commit is contained in:
@@ -16,18 +16,20 @@ frappe.ui.form.on("Payment Request", "onload", function(frm, dt, dn){
|
|||||||
})
|
})
|
||||||
|
|
||||||
frappe.ui.form.on("Payment Request", "refresh", function(frm) {
|
frappe.ui.form.on("Payment Request", "refresh", function(frm) {
|
||||||
frm.add_custom_button(__('Resend Payment Email'), function(){
|
if(!in_list(["Initiated", "Paid"], frm.doc.status) && !frm.doc.__islocal){
|
||||||
frappe.call({
|
frm.add_custom_button(__('Resend Payment Email'), function(){
|
||||||
method: "erpnext.accounts.doctype.payment_request.payment_request.resend_payment_email",
|
frappe.call({
|
||||||
args: {"docname": frm.doc.name},
|
method: "erpnext.accounts.doctype.payment_request.payment_request.resend_payment_email",
|
||||||
freeze: true,
|
args: {"docname": frm.doc.name},
|
||||||
freeze_message: __("Sending"),
|
freeze: true,
|
||||||
callback: function(r){
|
freeze_message: __("Sending"),
|
||||||
if(!r.exc) {
|
callback: function(r){
|
||||||
frappe.msgprint(__("Message Sent"));
|
if(!r.exc) {
|
||||||
|
frappe.msgprint(__("Message Sent"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -209,11 +209,11 @@ def get_amount(ref_doc, dt):
|
|||||||
"""get amount based on doctype"""
|
"""get amount based on doctype"""
|
||||||
if dt == "Sales Order":
|
if dt == "Sales Order":
|
||||||
base_grand_total = flt(ref_doc.base_grand_total)
|
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":
|
if dt == "Sales Invoice":
|
||||||
base_grand_total = flt(ref_doc.base_grand_total)
|
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 :
|
if base_grand_total > 0 and grand_total > 0 :
|
||||||
return base_grand_total, grand_total
|
return base_grand_total, grand_total
|
||||||
|
|||||||
Reference in New Issue
Block a user