test: Added new test to check wip skip

(cherry picked from commit 6edb454eea)
This commit is contained in:
Mihir Kandoi
2025-01-15 13:49:11 +05:30
committed by Mergify
parent 8ba42cfbf0
commit 4e1d4005d9
2 changed files with 31 additions and 7 deletions

View File

@@ -2459,6 +2459,37 @@ class TestWorkOrder(FrappeTestCase):
frappe.db.set_single_value("Manufacturing Settings", "validate_components_quantities_per_bom", 0)
def test_wip_skip(self):
wo = make_wo_order_test_record(
item="_Test FG Item",
qty=10,
source_warehouse="_Test Warehouse - _TC",
wip_warehouse="Stores - _TC",
)
manufacture_entry = frappe.get_doc(make_stock_entry(wo.name, "Manufacture", 10))
self.assertEqual(manufacture_entry.items[0].s_warehouse, "Stores - _TC")
wo = make_wo_order_test_record(
item="_Test FG Item",
qty=10,
source_warehouse="_Test Warehouse - _TC",
wip_warehouse="Stores - _TC",
skip_transfer=1,
)
manufacture_entry = frappe.get_doc(make_stock_entry(wo.name, "Manufacture", 10))
self.assertEqual(manufacture_entry.items[0].s_warehouse, "_Test Warehouse - _TC")
wo = make_wo_order_test_record(
item="_Test FG Item",
qty=10,
source_warehouse="_Test Warehouse - _TC",
wip_warehouse="Stores - _TC",
skip_transfer=1,
from_wip_warehouse=1,
)
manufacture_entry = frappe.get_doc(make_stock_entry(wo.name, "Manufacture", 10))
self.assertEqual(manufacture_entry.items[0].s_warehouse, "Stores - _TC")
def make_operation(**kwargs):
kwargs = frappe._dict(kwargs)

View File

@@ -544,13 +544,6 @@ frappe.ui.form.on("Work Order", {
erpnext.work_order.calculate_cost(frm.doc);
erpnext.work_order.calculate_total_cost(frm);
},
skip_transfer: function (frm) {
if (frm.doc.skip_transfer && !frm.doc.from_wip_warehouse) {
frm.set_value("wip_warehouse", null);
frm.refresh_field("wip_warehouse");
}
},
});
frappe.ui.form.on("Work Order Item", {