mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-13 03:45:08 +00:00
Merge pull request #52919 from frappe/mergify/bp/version-16-hotfix/pr-52822
fix(sales-order): update quotation status while cancelling sales order (backport #52822)
This commit is contained in:
@@ -1001,6 +1001,31 @@ class TestQuotation(IntegrationTestCase):
|
||||
so1.submit()
|
||||
self.assertRaises(frappe.ValidationError, so2.submit)
|
||||
|
||||
def test_quotation_status(self):
|
||||
quotation = make_quotation()
|
||||
|
||||
so1 = make_sales_order(quotation.name)
|
||||
so1.delivery_date = nowdate()
|
||||
so1.submit()
|
||||
quotation.reload()
|
||||
self.assertEqual(quotation.status, "Ordered")
|
||||
so1.cancel()
|
||||
|
||||
quotation.reload()
|
||||
self.assertEqual(quotation.status, "Open")
|
||||
|
||||
so2 = make_sales_order(quotation.name)
|
||||
so2.delivery_date = nowdate()
|
||||
so2.items[0].qty = 1
|
||||
so2.submit()
|
||||
quotation.reload()
|
||||
self.assertEqual(quotation.status, "Partially Ordered")
|
||||
|
||||
so2.cancel()
|
||||
|
||||
quotation.reload()
|
||||
self.assertEqual(quotation.status, "Open")
|
||||
|
||||
|
||||
def enable_calculate_bundle_price(enable=1):
|
||||
selling_settings = frappe.get_doc("Selling Settings")
|
||||
|
||||
@@ -530,7 +530,7 @@ class SalesOrder(SellingController):
|
||||
"Unreconcile Payment Entries",
|
||||
)
|
||||
super().on_cancel()
|
||||
|
||||
super().update_prevdoc_status()
|
||||
# Cannot cancel closed SO
|
||||
if self.status == "Closed":
|
||||
frappe.throw(_("Closed order cannot be cancelled. Unclose to cancel."))
|
||||
|
||||
Reference in New Issue
Block a user