From f55527b91e0ae0c98361956093ffbb6310f7d01e Mon Sep 17 00:00:00 2001 From: shubham Date: Thu, 16 Jan 2025 23:34:59 +0530 Subject: [PATCH] test: add test case of stock reservation entry on cancel --- .../selling/doctype/sales_order/test_sales_order.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py index f5919b3dcfb0..b759a389c0e9 100644 --- a/erpnext/selling/doctype/sales_order/test_sales_order.py +++ b/erpnext/selling/doctype/sales_order/test_sales_order.py @@ -4747,7 +4747,7 @@ def test_sales_order_for_auto_stock_reservation_TC_S_070(self, reuse=None): self.assertEqual(pr.status, "To Bill") qty_change = frappe.db.get_value('Stock Ledger Entry', {'item_code': '_Test Item', 'voucher_no': pr.name, 'warehouse': '_Test Warehouse - _TC'}, 'actual_qty') self.assertEqual(qty_change, 1) - + self.assertEqual(frappe.db.get_value("Stock Reservation Entry", {"voucher_no": so.name, "from_voucher_no": pr.name}, "status"), "Reserved") from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice @@ -4768,6 +4768,14 @@ def test_sales_order_for_stock_unreserve_TC_S_071(self): self.assertEqual(frappe.db.get_value("Stock Reservation Entry", {"voucher_no": so.name}, "status"), "Cancelled") + def test_stock_reservation_entry_on_cancel_TC_S_073(self): + so = self.test_sales_order_for_stock_reservation_TC_S_063(get_so_with_stock_reserved=1) + sre = frappe.get_doc("Stock Reservation Entry", {"voucher_no": so.name}) + sre.cancel() + sre.reload() + + self.assertEqual(sre.status, "Cancelled") + def create_and_submit_sales_order(self, qty=None, rate=None): sales_order = make_sales_order(cost_center='Main - _TC', selling_price_list='Standard Selling', do_not_save=True) sales_order.delivery_date = nowdate()