Test cases added in sales order to check total projected qty
This commit is contained in:
parent
ac9172f6df
commit
aa8abfa5b3
@ -125,9 +125,17 @@ class TestSalesOrder(unittest.TestCase):
|
||||
dn = create_dn_against_so(so.name, 15)
|
||||
self.assertEqual(get_reserved_qty(), existing_reserved_qty)
|
||||
|
||||
total_projected_qty = get_total_projected_qty('_Test Item')
|
||||
item_doc_before_cancel = frappe.get_doc('Item', '_Test Item')
|
||||
self.assertEqual(total_projected_qty, item_doc_before_cancel.total_projected_qty)
|
||||
|
||||
dn.cancel()
|
||||
self.assertEqual(get_reserved_qty(), existing_reserved_qty + 10)
|
||||
|
||||
total_projected_qty = get_total_projected_qty('_Test Item')
|
||||
item_doc_after_cancel = frappe.get_doc('Item', '_Test Item')
|
||||
self.assertEqual(total_projected_qty, item_doc_after_cancel.total_projected_qty)
|
||||
|
||||
def test_reserved_qty_for_over_delivery_via_sales_invoice(self):
|
||||
# set over-delivery tolerance
|
||||
frappe.db.set_value('Item', "_Test Item", 'tolerance', 50)
|
||||
@ -143,6 +151,10 @@ class TestSalesOrder(unittest.TestCase):
|
||||
si.insert()
|
||||
si.submit()
|
||||
|
||||
total_projected_qty = get_total_projected_qty('_Test Item')
|
||||
item_doc = frappe.get_doc('Item', '_Test Item')
|
||||
self.assertEqual(total_projected_qty, item_doc.total_projected_qty)
|
||||
|
||||
self.assertEqual(get_reserved_qty(), existing_reserved_qty)
|
||||
|
||||
so.load_from_db()
|
||||
@ -151,6 +163,9 @@ class TestSalesOrder(unittest.TestCase):
|
||||
|
||||
si.cancel()
|
||||
self.assertEqual(get_reserved_qty(), existing_reserved_qty + 10)
|
||||
total_projected_qty = get_total_projected_qty('_Test Item')
|
||||
item_doc = frappe.get_doc('Item', '_Test Item')
|
||||
self.assertEqual(total_projected_qty, item_doc.total_projected_qty)
|
||||
|
||||
so.load_from_db()
|
||||
self.assertEqual(so.get("items")[0].delivered_qty, 0)
|
||||
@ -179,6 +194,10 @@ class TestSalesOrder(unittest.TestCase):
|
||||
self.assertEqual(get_reserved_qty("_Test Item"), existing_reserved_qty_item1)
|
||||
self.assertEqual(get_reserved_qty("_Test Item Home Desktop 100"), existing_reserved_qty_item2)
|
||||
|
||||
total_projected_qty = get_total_projected_qty('_Test Item')
|
||||
item_doc = frappe.get_doc('Item', '_Test Item')
|
||||
self.assertEqual(total_projected_qty, item_doc.total_projected_qty)
|
||||
|
||||
# unclose so
|
||||
so.load_from_db()
|
||||
so.update_status('Draft')
|
||||
@ -212,6 +231,10 @@ class TestSalesOrder(unittest.TestCase):
|
||||
|
||||
dn = create_dn_against_so(so.name, 15)
|
||||
|
||||
total_projected_qty = get_total_projected_qty('_Test Item')
|
||||
item_doc = frappe.get_doc('Item', '_Test Item')
|
||||
self.assertEqual(total_projected_qty, item_doc.total_projected_qty)
|
||||
|
||||
self.assertEqual(get_reserved_qty("_Test Item"), existing_reserved_qty_item1)
|
||||
self.assertEqual(get_reserved_qty("_Test Item Home Desktop 100"),
|
||||
existing_reserved_qty_item2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user