test: show future payments allocated sales returns is considered as payment
diff --git a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
index de49139..0112982 100644
--- a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
@@ -469,11 +469,30 @@
 		)
 
 	def test_future_payments(self):
+		sr = self.create_sales_invoice(do_not_submit=True)
+		sr.is_return = 1
+		sr.items[0].qty = -1
+		sr.items[0].rate = 10
+		sr.calculate_taxes_and_totals()
+		sr.submit()
+
 		si = self.create_sales_invoice()
 		pe = get_payment_entry(si.doctype, si.name)
+		pe.append(
+			"references",
+			{
+				"reference_doctype": sr.doctype,
+				"reference_name": sr.name,
+				"due_date": sr.due_date,
+				"total_amount": sr.grand_total,
+				"outstanding_amount": sr.outstanding_amount,
+				"allocated_amount": sr.outstanding_amount,
+			},
+		)
+
 		pe.posting_date = add_days(today(), 1)
-		pe.paid_amount = 90.0
-		pe.references[0].allocated_amount = 90.0
+		pe.paid_amount = 80
+		pe.references[0].allocated_amount = 90.0  # pe.paid_amount + sr.grand_total
 		pe.save().submit()
 		filters = {
 			"company": self.company,
@@ -485,16 +504,21 @@
 			"show_future_payments": True,
 		}
 		report = execute(filters)[1]
-		self.assertEqual(len(report), 1)
+		self.assertEqual(len(report), 2)
 
-		expected_data = [100.0, 100.0, 10.0, 90.0]
+		expected_data = {sr.name: [10.0, -10.0, 0.0, -10], si.name: [100.0, 100.0, 10.0, 90.0]}
 
-		row = report[0]
-		self.assertEqual(
-			expected_data, [row.invoiced, row.outstanding, row.remaining_balance, row.future_amount]
-		)
+		rows = report[:2]
+		for row in rows:
+			self.assertEqual(
+				expected_data[row.voucher_no],
+				[row.invoiced or row.paid, row.outstanding, row.remaining_balance, row.future_amount],
+			)
 
 		pe.cancel()
+		sr.load_from_db()  # Outstanding amount is updated so a updated timestamp is needed.
+		sr.cancel()
+
 		# full payment in future date
 		pe = get_payment_entry(si.doctype, si.name)
 		pe.posting_date = add_days(today(), 1)