test: assert ledger after cr note cancellation
diff --git a/erpnext/controllers/tests/test_accounts_controller.py b/erpnext/controllers/tests/test_accounts_controller.py
index fc4fb9f..415e173 100644
--- a/erpnext/controllers/tests/test_accounts_controller.py
+++ b/erpnext/controllers/tests/test_accounts_controller.py
@@ -964,3 +964,19 @@
si.reload()
self.assertEqual(si.outstanding_amount, 1)
self.assert_ledger_outstanding(si.doctype, si.name, 80.0, 1.0)
+
+ cr_note.reload()
+ cr_note.cancel()
+
+ # Exchange Gain/Loss Journal should've been created.
+ exc_je_for_si = self.get_journals_for(si.doctype, si.name)
+ exc_je_for_cr = self.get_journals_for(cr_note.doctype, cr_note.name)
+ self.assertNotEqual(exc_je_for_si, [])
+ self.assertEqual(len(exc_je_for_si), 1)
+ self.assertEqual(len(exc_je_for_cr), 0)
+
+ # The Credit Note JE is still active and is referencing the sales invoice
+ # So, outstanding stays the same
+ si.reload()
+ self.assertEqual(si.outstanding_amount, 1)
+ self.assert_ledger_outstanding(si.doctype, si.name, 80.0, 1.0)