fix: tests

This commit is contained in:
Mihir Kandoi
2025-01-14 16:27:49 +05:30
parent bbb5f8056b
commit 09d26a835f
4 changed files with 20 additions and 8 deletions

View File

@@ -884,9 +884,9 @@ class TestProductionPlan(IntegrationTestCase):
"""
from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
make_stock_entry(item_code="_Test Item", target="Work In Progress - _TC", qty=2, basic_rate=100)
make_stock_entry(item_code="_Test Item", target="_Test Warehouse - _TC", qty=2, basic_rate=100)
make_stock_entry(
item_code="_Test Item Home Desktop 100", target="Work In Progress - _TC", qty=4, basic_rate=100
item_code="_Test Item Home Desktop 100", target="_Test Warehouse - _TC", qty=4, basic_rate=100
)
item = "_Test FG Item"
@@ -934,10 +934,10 @@ class TestProductionPlan(IntegrationTestCase):
from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
make_stock_entry(
item_code="Raw Material Item 1", target="Work In Progress - _TC", qty=2, basic_rate=100
item_code="Raw Material Item 1", target="_Test Warehouse - _TC", qty=2, basic_rate=100
)
make_stock_entry(
item_code="Raw Material Item 2", target="Work In Progress - _TC", qty=2, basic_rate=100
item_code="Raw Material Item 2", target="_Test Warehouse - _TC", qty=2, basic_rate=100
)
pln = create_production_plan(item_code="Test Production Item 1", skip_getting_mr_items=True)

View File

@@ -724,7 +724,12 @@ class TestWorkOrder(IntegrationTestCase):
self.assertEqual(row.item_code, fg_item)
work_order = make_wo_order_test_record(
item=fg_item, skip_transfer=True, planned_start_date=now(), qty=30, do_not_save=True
item=fg_item,
skip_transfer=True,
planned_start_date=now(),
qty=30,
do_not_save=True,
source_warehouse="_Test Warehouse - _TC",
)
work_order.batch_size = 10
work_order.insert()
@@ -941,11 +946,13 @@ class TestWorkOrder(IntegrationTestCase):
wip_warehouse=wip_warehouse,
qty=qty,
skip_transfer=1,
source_warehouse=wip_warehouse,
stock_uom=fg_item_non_whole.stock_uom,
)
se = frappe.get_doc(make_stock_entry(wo.name, "Material Transfer for Manufacture", qty))
se.get("items")[0].s_warehouse = "Stores - _TC"
se.get("items")[0].t_warehouse = wip_warehouse
se.insert()
se.submit()
@@ -2061,6 +2068,7 @@ class TestWorkOrder(IntegrationTestCase):
bom_no=bom_doc.name,
qty=1,
skip_transfer=1,
source_warehouse="_Test Warehouse - _TC",
)
job_cards = frappe.get_all("Job Card", filters={"work_order": wo.name})

View File

@@ -1465,7 +1465,11 @@ def make_stock_entry(work_order_id, purpose, qty=None, target_warehouse=None):
stock_entry.to_warehouse = wip_warehouse
stock_entry.project = work_order.project
else:
stock_entry.from_warehouse = wip_warehouse
stock_entry.from_warehouse = (
work_order.source_warehouse
if work_order.skip_transfer and not work_order.from_wip_warehouse
else wip_warehouse
)
stock_entry.to_warehouse = work_order.fg_warehouse
stock_entry.project = work_order.project

View File

@@ -1712,13 +1712,13 @@ class TestSalesOrder(AccountsTestMixin, IntegrationTestCase):
wo.submit()
make_stock_entry(
item_code="_Test Item",
target="Work In Progress - _TC",
target="_Test Warehouse - _TC",
qty=4,
basic_rate=100, # Stock RM
)
make_stock_entry(
item_code="_Test Item Home Desktop 100", # Stock RM
target="Work In Progress - _TC",
target="_Test Warehouse - _TC",
qty=4,
basic_rate=100,
)