Skip to content

Commit

Permalink
test: assert ledger after cr note cancellation
Browse files Browse the repository at this point in the history
(cherry picked from commit ae424fd)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Aug 14, 2023
1 parent 349601b commit c5c440b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions erpnext/controllers/tests/test_accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,3 +964,19 @@ def test_30_cr_note_against_sales_invoice(self):
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)

0 comments on commit c5c440b

Please sign in to comment.