Merge pull request #40967 from rohitwaghchaure/fixed-13250

fix: zero division error
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 60ba0d1..f87dc4f 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -441,7 +441,7 @@
 				get_valuation_method(d.item_code) == "Moving Average" and self.get("is_return")
 			):
 				# Get incoming rate based on original item cost based on valuation method
-				qty = flt(d.get("stock_qty") or d.get("actual_qty"))
+				qty = flt(d.get("stock_qty") or d.get("actual_qty") or d.get("qty"))
 
 				if (
 					not d.incoming_rate