Check for duplicate challan number only in submitted purchase receipts
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 0572592..41ee2ff 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -93,11 +93,12 @@
 
 
   def validate_challan_no(self):
-    "Validate if same challan no exists for same supplier in a purchase receipt"
+    "Validate if same challan no exists for same supplier in a submitted purchase receipt"
     if self.doc.challan_no:
       exists = webnotes.conn.sql("""
 	    SELECT name FROM `tabPurchase Receipt`
-	    WHERE name!=%s AND supplier=%s AND challan_no=%s""", (self.doc.name, self.doc.supplier, self.doc.challan_no))
+	    WHERE name!=%s AND supplier=%s AND challan_no=%s
+		AND docstatus=1""", (self.doc.name, self.doc.supplier, self.doc.challan_no))
       if exists:
 	    webnotes.msgprint("Another Purchase Receipt using the same Challan No. already exists.\
 		  Please enter a valid Challan No.", raise_exception=1)