fix(test): manually filter rows and assert

This commit is contained in:
ruthra kumar
2024-03-14 09:32:27 +05:30
parent 437bdc2d8c
commit a9a9b1297e

View File

@@ -182,8 +182,10 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase):
} }
# check invoice grand total and invoiced column's value for 3 payment terms # check invoice grand total and invoiced column's value for 3 payment terms
si = self.create_sales_invoice(no_payment_schedule=True) si = self.create_sales_invoice(no_payment_schedule=True, do_not_submit=True)
name = si.name si.set_posting_time = True
si.posting_date = add_days(today(), -1)
si.save().submit()
report = execute(filters) report = execute(filters)
@@ -212,23 +214,37 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase):
report = execute(filters) report = execute(filters)
expected_data_after_credit_note = [ expected_data_after_credit_note = [
[100.0, 100.0, 40.0, 0.0, 60.0, self.debit_to], [100.0, 100.0, 40.0, 0.0, 60.0, si.name],
[0, 0, 100.0, 0.0, -100.0, self.debit_to], [0, 0, 100.0, 0.0, -100.0, cr_note.name],
] ]
self.assertEqual(len(report[1]), 2) self.assertEqual(len(report[1]), 2)
for i in range(2): si_row = [
row = report[1][i] [
self.assertEqual( row.invoice_grand_total,
expected_data_after_credit_note[i], row.invoiced,
[ row.paid,
row.invoice_grand_total, row.credit_note,
row.invoiced, row.outstanding,
row.paid, row.voucher_no,
row.credit_note, ]
row.outstanding, for row in report[1]
row.party_account, if row.voucher_no == si.name
], ][0]
)
cr_note_row = [
[
row.invoice_grand_total,
row.invoiced,
row.paid,
row.credit_note,
row.outstanding,
row.voucher_no,
]
for row in report[1]
if row.voucher_no == cr_note.name
][0]
self.assertEqual(expected_data_after_credit_note[0], si_row)
self.assertEqual(expected_data_after_credit_note[1], cr_note_row)
def test_payment_againt_po_in_receivable_report(self): def test_payment_againt_po_in_receivable_report(self):
""" """