Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-kandoi committed Jan 14, 2025
1 parent bbb5f80 commit 09d26a8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -884,9 +884,9 @@ def test_production_plan_pending_qty_with_sales_order(self):
"""
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"
Expand Down Expand Up @@ -934,10 +934,10 @@ def test_production_plan_pending_qty_independent_items(self):
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)
Expand Down
10 changes: 9 additions & 1 deletion erpnext/manufacturing/doctype/work_order/test_work_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,12 @@ def test_batch_size_for_fg_item(self):
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()
Expand Down Expand Up @@ -941,11 +946,13 @@ def test_wo_completion_with_pl_bom(self):
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()

Expand Down Expand Up @@ -2061,6 +2068,7 @@ def test_operating_cost_account(self):
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})
Expand Down
6 changes: 5 additions & 1 deletion erpnext/manufacturing/doctype/work_order/work_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions erpnext/selling/doctype/sales_order/test_sales_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -1712,13 +1712,13 @@ def test_so_back_updated_from_wo_via_mr(self):
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,
)
Expand Down

0 comments on commit 09d26a8

Please sign in to comment.