refactor: ignore unreconcile doc for PO and SO on cancel/delete

(cherry picked from commit b618d685c6)
This commit is contained in:
ljain112
2024-06-14 13:13:11 +05:30
committed by Mergify
parent 60b16a4b1e
commit 7cc5579eca
4 changed files with 20 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ erpnext.buying.setup_buying_controller();
frappe.ui.form.on("Purchase Order", {
setup: function (frm) {
frm.ignore_doctypes_on_cancel_all = ["Unreconcile Payment", "Unreconcile Payment Entries"];
if (frm.doc.is_old_subcontracting_flow) {
frm.set_query("reserve_warehouse", "supplied_items", function () {
return {

View File

@@ -484,7 +484,13 @@ class PurchaseOrder(BuyingController):
self.auto_create_subcontracting_order()
def on_cancel(self):
self.ignore_linked_doctypes = ("GL Entry", "Payment Ledger Entry")
self.ignore_linked_doctypes = (
"GL Entry",
"Payment Ledger Entry",
"Unreconcile Payment",
"Unreconcile Payment Entries",
)
super().on_cancel()
if self.is_against_so():

View File

@@ -217,7 +217,11 @@ frappe.ui.form.on("Sales Order", {
frm.set_value("advance_paid", 0);
}
frm.ignore_doctypes_on_cancel_all = ["Purchase Order"];
frm.ignore_doctypes_on_cancel_all = [
"Purchase Order",
"Unreconcile Payment",
"Unreconcile Payment Entries",
];
},
delivery_date: function (frm) {

View File

@@ -421,7 +421,13 @@ class SalesOrder(SellingController):
self.create_stock_reservation_entries()
def on_cancel(self):
self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry", "Payment Ledger Entry")
self.ignore_linked_doctypes = (
"GL Entry",
"Stock Ledger Entry",
"Payment Ledger Entry",
"Unreconcile Payment",
"Unreconcile Payment Entries",
)
super().on_cancel()
# Cannot cancel closed SO