Merge pull request #8054 from rohitwaghchaure/purchase_return_issue_invoice

[fix] Quantity is not copying in the Received Qty during making of debit note from the purchase invoice
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 47cdefc..6074cc6 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -139,7 +139,7 @@
 
 	qty: function(doc, cdt, cdn) {
 		var item = frappe.get_doc(cdt, cdn);
-		if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && doc.update_stock)) {
+		if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && (doc.update_stock || doc.is_return))) {
 			frappe.model.round_floats_in(item, ["qty", "received_qty"]);
 			if(!item.rejected_qty && item.qty) {
 				item.received_qty = item.qty;