Fixes for subcontracting
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 43276e5..ad56d8f 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -256,7 +256,7 @@
 
 			rm_supplied_idx += 1
 
-			raw_materials_cost += required_qty * flt(item.rate)
+			raw_materials_cost += required_qty * flt(bom_item.rate)
 
 		if self.doctype == "Purchase Receipt":
 			item.rm_supp_cost = raw_materials_cost