Skip to content

Commit

Permalink
Merge pull request #41937 from frappe/mergify/bp/version-14-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 077cb9e + 2fabcb0 commit 57a81c4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions erpnext/buying/doctype/purchase_order/purchase_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ frappe.provide("erpnext.accounts.dimensions");
{% include 'erpnext/public/js/controllers/buying.js' %};

frappe.ui.form.on("Purchase Order", {
setup: function(frm) {

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 @@ -345,7 +345,13 @@ def on_submit(self):
update_linked_doc(self.doctype, self.name, self.inter_company_order_reference)

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 @@ -150,7 +150,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 @@ -269,7 +269,13 @@ def on_submit(self):
update_coupon_code_count(self.coupon_code, "used")

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 57a81c4

Please sign in to comment.