diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 43276e59775..ad56d8fe94e 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -256,7 +256,7 @@ class BuyingController(StockController): 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 diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index 0aa3accd4ad..77de44d0218 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -94,8 +94,9 @@ class TestPurchaseReceipt(unittest.TestCase): pr.run_method("calculate_taxes_and_totals") pr.insert() - self.assertEquals(pr.get("purchase_receipt_details")[0].rm_supp_cost, 70000.0) self.assertEquals(len(pr.get("pr_raw_material_details")), 2) + self.assertEquals(pr.get("purchase_receipt_details")[0].rm_supp_cost, 70000.0) + def test_serial_no_supplier(self): pr = frappe.copy_doc(test_records[0])