fix: test_work_order_with_non_stock_item

- Use the right price list and currency to avoid rate conversion (1000/62.9), since rates are reset correctly now
- Use RM rate based on Price List in BOM. Non stock item has no valuation
This commit is contained in:
marination 2022-05-20 01:02:56 +05:30
parent dd99c00eb6
commit 90d4dc0cd6
2 changed files with 12 additions and 4 deletions

View File

@ -798,7 +798,6 @@ def make_bom(**args):
for item in args.raw_materials:
item_doc = frappe.get_doc("Item", item)
bom.append(
"items",
{

View File

@ -417,7 +417,7 @@ class TestWorkOrder(FrappeTestCase):
"doctype": "Item Price",
"item_code": "_Test FG Non Stock Item",
"price_list_rate": 1000,
"price_list": "Standard Buying",
"price_list": "_Test Price List India",
}
).insert(ignore_permissions=True)
@ -426,8 +426,17 @@ class TestWorkOrder(FrappeTestCase):
item_code="_Test FG Item", target="_Test Warehouse - _TC", qty=1, basic_rate=100
)
if not frappe.db.get_value("BOM", {"item": fg_item}):
make_bom(item=fg_item, rate=1000, raw_materials=["_Test FG Item", "_Test FG Non Stock Item"])
if not frappe.db.get_value("BOM", {"item": fg_item, "docstatus": 1}):
bom = make_bom(
item=fg_item,
rate=1000,
raw_materials=["_Test FG Item", "_Test FG Non Stock Item"],
do_not_save=True,
)
bom.rm_cost_as_per = "Price List" # non stock item won't have valuation rate
bom.buying_price_list = "_Test Price List India"
bom.currency = "INR"
bom.save()
wo = make_wo_order_test_record(production_item=fg_item)