fix(test): BOM raw materials rate from price list as per uom
diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py
index 5b8acaf..1129025 100644
--- a/erpnext/manufacturing/doctype/bom/test_bom.py
+++ b/erpnext/manufacturing/doctype/bom/test_bom.py
@@ -76,7 +76,7 @@
# update cost of all BOMs based on latest valuation rate
update_cost()
-
+
# check if new valuation rate updated in all BOMs
for d in frappe.db.sql("""select rate from `tabBOM Item`
where item_code='_Test Item 2' and docstatus=1 and parenttype='BOM'""", as_dict=1):
@@ -97,6 +97,7 @@
self.assertEqual(bom.base_total_cost, 486000)
def test_bom_cost_multi_uom_multi_currency(self):
+ frappe.db.set_value("Price List", "_Test Price List", "price_not_uom_dependant", 1)
for item_code, rate in (("_Test Item", 3600), ("_Test Item Home Desktop Manufactured", 3000)):
frappe.db.sql("delete from `tabItem Price` where price_list='_Test Price List' and item_code=%s",
item_code)
@@ -105,7 +106,7 @@
item_price.item_code = item_code
item_price.price_list_rate = rate
item_price.insert()
-
+
bom = frappe.copy_doc(test_records[2])
bom.set_rate_of_sub_assembly_item_based_on_bom = 0
bom.rm_cost_as_per = "Price List"
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index 1ad6e64..6c84ef1 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -457,7 +457,7 @@
if row['purchase_uom'] != row['stock_uom']:
if not row['conversion_factor']:
frappe.throw(_("UOM Conversion factor ({0} -> {1}) not found for item: {2}")
- .format(row['purchase_uom'], row['stock_uom'], item))
+ .format(row['purchase_uom'], row['stock_uom'], row.item_code))
requested_qty = requested_qty / row['conversion_factor']
if frappe.db.get_value("UOM", row['purchase_uom'], "must_be_whole_number"):
@@ -546,7 +546,7 @@
ignore_existing_ordered_qty = data.get('ignore_existing_ordered_qty') or doc.get('ignore_existing_ordered_qty')
planned_qty = data.get('required_qty') or data.get('planned_qty')
item_details = {}
- if data.get("bom"):
+ if data.get("bom") or data.get("bom_no"):
if data.get('required_qty'):
bom_no = data.get('bom')
include_non_stock_items = 1
@@ -563,7 +563,7 @@
if data.get('include_exploded_items') and include_subcontracted_items:
# fetch exploded items from BOM
item_details = get_exploded_items(item_details,
- company, bom_no,include_non_stock_items, planned_qty=planned_qty)
+ company, bom_no, include_non_stock_items, planned_qty=planned_qty)
else:
item_details = get_subitems(doc, data, item_details, bom_no, company,
include_non_stock_items, include_subcontracted_items, 1, planned_qty=planned_qty)
@@ -591,7 +591,6 @@
'conversion_factor' : conversion_factor,
}
)
-
if not sales_order:
sales_order = doc.get("sales_order")