Skip to content

Commit

Permalink
Merge pull request #41900 from ljain112/unreco
Browse files Browse the repository at this point in the history
refactor: ignore unreconcile doc for PO and SO on cancel/delete
  • Loading branch information
ruthra-kumar authored Jun 18, 2024
2 parents 1cce706 + b618d68 commit 8a397a4
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 @@ -488,7 +488,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 @@ -227,7 +227,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 @@ -423,7 +423,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 8a397a4

Please sign in to comment.