Merge pull request #1610 from nabinhait/v4-hotfix

minor fix
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index d2fc2bf..43276e5 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -248,7 +248,7 @@
 			rm.amount = required_qty * flt(bom_item.rate)
 			rm.idx = rm_supplied_idx
 
-			if self.doc.doctype == "Purchase Receipt":
+			if self.doctype == "Purchase Receipt":
 				rm.consumed_qty = required_qty
 				rm.description = bom_item.description
 				if item.batch_no and not rm.batch_no: