Skip to content

Commit 3a0f90c

Browse files
SowmyaArunachalammergify[bot]
authored andcommitted
fix(sales-order): update quotation status while cancelling sales order (#52822)
* fix(sales-order): update quotation status while cancelling sales order * test: validate quotation status * chore: remove submit (cherry picked from commit d638f3e)
1 parent 2177098 commit 3a0f90c

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

erpnext/selling/doctype/quotation/test_quotation.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,31 @@ def test_over_order_limit(self):
10011001
so1.submit()
10021002
self.assertRaises(frappe.ValidationError, so2.submit)
10031003

1004+
def test_quotation_status(self):
1005+
quotation = make_quotation()
1006+
1007+
so1 = make_sales_order(quotation.name)
1008+
so1.delivery_date = nowdate()
1009+
so1.submit()
1010+
quotation.reload()
1011+
self.assertEqual(quotation.status, "Ordered")
1012+
so1.cancel()
1013+
1014+
quotation.reload()
1015+
self.assertEqual(quotation.status, "Open")
1016+
1017+
so2 = make_sales_order(quotation.name)
1018+
so2.delivery_date = nowdate()
1019+
so2.items[0].qty = 1
1020+
so2.submit()
1021+
quotation.reload()
1022+
self.assertEqual(quotation.status, "Partially Ordered")
1023+
1024+
so2.cancel()
1025+
1026+
quotation.reload()
1027+
self.assertEqual(quotation.status, "Open")
1028+
10041029

10051030
def enable_calculate_bundle_price(enable=1):
10061031
selling_settings = frappe.get_doc("Selling Settings")

erpnext/selling/doctype/sales_order/sales_order.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def on_cancel(self):
530530
"Unreconcile Payment Entries",
531531
)
532532
super().on_cancel()
533-
533+
super().update_prevdoc_status()
534534
# Cannot cancel closed SO
535535
if self.status == "Closed":
536536
frappe.throw(_("Closed order cannot be cancelled. Unclose to cancel."))

0 commit comments

Comments
 (0)