Skip to content

Commit

Permalink
Merge pull request #41938 from frappe/mergify/bp/version-15-hotfix/pr…
Browse files Browse the repository at this point in the history
…-41900

refactor: ignore unreconcile doc for PO and SO on cancel/delete (backport #41900)
  • Loading branch information
ruthra-kumar authored Jun 18, 2024
2 parents 60b16a4 + 7cc5579 commit d64432c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions erpnext/buying/doctype/purchase_order/purchase_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 7 additions & 1 deletion erpnext/buying/doctype/purchase_order/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,13 @@ def on_submit(self):
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():
Expand Down
6 changes: 5 additions & 1 deletion erpnext/selling/doctype/sales_order/sales_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 7 additions & 1 deletion erpnext/selling/doctype/sales_order/sales_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,13 @@ def on_submit(self):
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
Expand Down

0 comments on commit d64432c

Please sign in to comment.