mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
test: po updates packed item's ordered_qty
This commit is contained in:
@@ -959,6 +959,42 @@ class TestSalesOrder(ERPNextTestCase):
|
|||||||
self.assertEqual(purchase_order.items[0].item_code, "_Test Bundle Item 1")
|
self.assertEqual(purchase_order.items[0].item_code, "_Test Bundle Item 1")
|
||||||
self.assertEqual(purchase_order.items[1].item_code, "_Test Bundle Item 2")
|
self.assertEqual(purchase_order.items[1].item_code, "_Test Bundle Item 2")
|
||||||
|
|
||||||
|
def test_purchase_order_updates_packed_item_ordered_qty(self):
|
||||||
|
"""
|
||||||
|
Tests if the packed item's `ordered_qty` is updated with the quantity of the Purchase Order
|
||||||
|
"""
|
||||||
|
from erpnext.selling.doctype.sales_order.sales_order import make_purchase_order
|
||||||
|
|
||||||
|
product_bundle = make_item("_Test Product Bundle", {"is_stock_item": 0})
|
||||||
|
make_item("_Test Bundle Item 1", {"is_stock_item": 1})
|
||||||
|
make_item("_Test Bundle Item 2", {"is_stock_item": 1})
|
||||||
|
|
||||||
|
make_product_bundle("_Test Product Bundle",
|
||||||
|
["_Test Bundle Item 1", "_Test Bundle Item 2"])
|
||||||
|
|
||||||
|
so_items = [
|
||||||
|
{
|
||||||
|
"item_code": product_bundle.item_code,
|
||||||
|
"warehouse": "",
|
||||||
|
"qty": 2,
|
||||||
|
"rate": 400,
|
||||||
|
"delivered_by_supplier": 1,
|
||||||
|
"supplier": '_Test Supplier'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
so = make_sales_order(item_list=so_items)
|
||||||
|
|
||||||
|
purchase_order = make_purchase_order(so.name, selected_items=so_items)
|
||||||
|
purchase_order.supplier = "_Test Supplier"
|
||||||
|
purchase_order.set_warehouse = "_Test Warehouse - _TC"
|
||||||
|
purchase_order.save()
|
||||||
|
purchase_order.submit()
|
||||||
|
|
||||||
|
so.reload()
|
||||||
|
self.assertEqual(so.packed_items[0].ordered_qty, 2)
|
||||||
|
self.assertEqual(so.packed_items[1].ordered_qty, 2)
|
||||||
|
|
||||||
def test_reserved_qty_for_closing_so(self):
|
def test_reserved_qty_for_closing_so(self):
|
||||||
bin = frappe.get_all("Bin", filters={"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC"},
|
bin = frappe.get_all("Bin", filters={"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC"},
|
||||||
fields=["reserved_qty"])
|
fields=["reserved_qty"])
|
||||||
|
|||||||
Reference in New Issue
Block a user