mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-25 14:11:45 +01:00
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 d638f3e033)
This commit is contained in:
@@ -994,6 +994,31 @@ class TestQuotation(FrappeTestCase):
|
|||||||
so1.submit()
|
so1.submit()
|
||||||
self.assertRaises(frappe.ValidationError, so2.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")
|
||||||
|
|
||||||
|
|
||||||
test_records = frappe.get_test_records("Quotation")
|
test_records = frappe.get_test_records("Quotation")
|
||||||
|
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ class SalesOrder(SellingController):
|
|||||||
"Unreconcile Payment Entries",
|
"Unreconcile Payment Entries",
|
||||||
)
|
)
|
||||||
super().on_cancel()
|
super().on_cancel()
|
||||||
|
super().update_prevdoc_status()
|
||||||
# Cannot cancel closed SO
|
# Cannot cancel closed SO
|
||||||
if self.status == "Closed":
|
if self.status == "Closed":
|
||||||
frappe.throw(_("Closed order cannot be cancelled. Unclose to cancel."))
|
frappe.throw(_("Closed order cannot be cancelled. Unclose to cancel."))
|
||||||
|
|||||||
Reference in New Issue
Block a user