Validate for negative outstanding reference only if party is Customer or Supplier (#10568)

This commit is contained in:
Nabin Hait 2017-08-28 11:23:33 +05:30 committed by Makarand Bauskar
parent caab582943
commit 2df0788c11

View File

@ -569,7 +569,7 @@ frappe.ui.form.on('Payment Entry', {
}) })
var allocated_negative_outstanding = 0; var allocated_negative_outstanding = 0;
if((frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") || if ((frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") ||
(frm.doc.payment_type=="Pay" && frm.doc.party_type=="Supplier") || (frm.doc.payment_type=="Pay" && frm.doc.party_type=="Supplier") ||
(frm.doc.payment_type=="Pay" && frm.doc.party_type=="Employee")) { (frm.doc.payment_type=="Pay" && frm.doc.party_type=="Employee")) {
if(total_positive_outstanding_including_order > paid_amount) { if(total_positive_outstanding_including_order > paid_amount) {
@ -579,7 +579,7 @@ frappe.ui.form.on('Payment Entry', {
} }
var allocated_positive_outstanding = paid_amount + allocated_negative_outstanding; var allocated_positive_outstanding = paid_amount + allocated_negative_outstanding;
} else { } else if (in_list(["Customer", "Supplier"], frm.doc.party_type)) {
if(paid_amount > total_negative_outstanding) { if(paid_amount > total_negative_outstanding) {
if(total_negative_outstanding == 0) { if(total_negative_outstanding == 0) {
frappe.msgprint(__("Cannot {0} {1} {2} without any negative outstanding invoice", frappe.msgprint(__("Cannot {0} {1} {2} without any negative outstanding invoice",