mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-23 03:10:04 +00:00
test(manufacturing): cover rounding-loss snapping
This commit is contained in:
@@ -1696,6 +1696,32 @@ class TestWorkOrder(ERPNextTestSuite):
|
||||
work_order.reload()
|
||||
self.assertEqual(work_order.material_transferred_for_manufacturing, 1.0)
|
||||
|
||||
def test_material_transferred_snaps_conversion_rounding_losses(self):
|
||||
"""A full transfer whose rows come out marginally short from UOM-conversion rounding
|
||||
must count as fully transferred instead of storing values like 172.4789 for 172.5."""
|
||||
work_order = make_wo_order_test_record(planned_start_date=now(), qty=2000)
|
||||
test_stock_entry.make_stock_entry(
|
||||
item_code="_Test Item", target="_Test Warehouse - _TC", qty=5000, basic_rate=5000.0
|
||||
)
|
||||
test_stock_entry.make_stock_entry(
|
||||
item_code="_Test Item Home Desktop 100",
|
||||
target="_Test Warehouse - _TC",
|
||||
qty=5000,
|
||||
basic_rate=1000.0,
|
||||
)
|
||||
|
||||
required_qty = {row.item_code: flt(row.required_qty) for row in work_order.required_items}
|
||||
transfer_entry = frappe.get_doc(
|
||||
make_stock_entry(work_order.name, "Material Transfer for Manufacture", 0)
|
||||
)
|
||||
for item in transfer_entry.items:
|
||||
item.qty = required_qty[item.item_code] * 0.9995
|
||||
item.transfer_qty = item.qty
|
||||
transfer_entry.submit()
|
||||
|
||||
work_order.reload()
|
||||
self.assertEqual(work_order.material_transferred_for_manufacturing, 2000.0)
|
||||
|
||||
def test_status_in_process_when_only_one_required_item_transferred(self):
|
||||
"""Stock Entry created from a Pick List that picked only one of the required items:
|
||||
min-fraction keeps material_transferred_for_manufacturing at 0, but the work order must
|
||||
|
||||
Reference in New Issue
Block a user