From ba61292dfc0d767ab8c88bd05cadff2ad7ed1237 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Sat, 29 Apr 2023 07:25:35 +0530 Subject: [PATCH] test: add test case for packed qty validation on DN submit --- .../doctype/packing_slip/test_packing_slip.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/packing_slip/test_packing_slip.py b/erpnext/stock/doctype/packing_slip/test_packing_slip.py index e8873e3821..96da23db4a 100644 --- a/erpnext/stock/doctype/packing_slip/test_packing_slip.py +++ b/erpnext/stock/doctype/packing_slip/test_packing_slip.py @@ -95,13 +95,22 @@ class TestPackingSlip(FrappeTestCase): # Test - 5: Should throw an ValidationError, as Packing Slip Qty is more than Delivery Note Qty self.assertRaises(frappe.exceptions.ValidationError, ps3.save) + # Step - 8: Make Packing Slip for less Qty than Delivery Note + ps4 = make_packing_slip(dn.name) + ps4.items[0].qty = 5 + ps4.save() + ps4.submit() + + # Test - 6: Delivery Note should throw a ValidationError on Submit, as Packed Qty and Delivery Note Qty are not the same + dn.load_from_db() + self.assertRaises(frappe.exceptions.ValidationError, dn.submit) + def create_items(): items_properties = [ {"is_stock_item": 0}, - {"is_stock_item": 1}, - {"is_stock_item": 1}, - {"is_stock_item": 1}, + {"is_stock_item": 1, "stock_uom": "Nos"}, + {"is_stock_item": 1, "stock_uom": "Box"}, ] items = []