Skip to content

Commit

Permalink
test: add test case of stock reservation entry on cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-DT committed Jan 16, 2025
1 parent ea02190 commit f55527b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion erpnext/selling/doctype/sales_order/test_sales_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down

0 comments on commit f55527b

Please sign in to comment.