fix: Reset advance paid amount on Oreder cancel and amend

(cherry picked from commit 92f37ca111)

# Conflicts:
#	erpnext/buying/doctype/purchase_order/purchase_order.js
This commit is contained in:
Deepesh Garg
2022-10-31 19:01:54 +05:30
committed by Mergify
parent 0c24ba0118
commit e32e0bc8fa
2 changed files with 33 additions and 0 deletions

View File

@@ -84,7 +84,35 @@ frappe.ui.form.on("Purchase Order", {
});
}, __('Create'));
}
<<<<<<< HEAD
}
=======
},
onload: function(frm) {
set_schedule_date(frm);
if (!frm.doc.transaction_date){
frm.set_value('transaction_date', frappe.datetime.get_today())
}
erpnext.queries.setup_queries(frm, "Warehouse", function() {
return erpnext.queries.warehouse(frm.doc);
});
// On cancel and amending a purchase order with advance payment, reset advance paid amount
if (frm.is_new()) {
frm.set_value("advance_paid", 0)
}
},
apply_tds: function(frm) {
if (!frm.doc.apply_tds) {
frm.set_value("tax_withholding_category", '');
} else {
frm.set_value("tax_withholding_category", frm.supplier_tds);
}
},
>>>>>>> 92f37ca111 (fix: Reset advance paid amount on Oreder cancel and amend)
});
frappe.ui.form.on("Purchase Order Item", {

View File

@@ -95,6 +95,11 @@ frappe.ui.form.on("Sales Order", {
return query;
});
// On cancel and amending a sales order with advance payment, reset advance paid amount
if (frm.is_new()) {
frm.set_value("advance_paid", 0)
}
frm.ignore_doctypes_on_cancel_all = ['Purchase Order'];
},