mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
test: cr note flag to update self
(cherry picked from commit ce3b1f09f5)
This commit is contained in:
@@ -62,7 +62,7 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase):
|
|||||||
pe.insert()
|
pe.insert()
|
||||||
pe.submit()
|
pe.submit()
|
||||||
|
|
||||||
def create_credit_note(self, docname):
|
def create_credit_note(self, docname, do_not_submit=False):
|
||||||
credit_note = create_sales_invoice(
|
credit_note = create_sales_invoice(
|
||||||
company=self.company,
|
company=self.company,
|
||||||
customer=self.customer,
|
customer=self.customer,
|
||||||
@@ -72,6 +72,7 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase):
|
|||||||
cost_center=self.cost_center,
|
cost_center=self.cost_center,
|
||||||
is_return=1,
|
is_return=1,
|
||||||
return_against=docname,
|
return_against=docname,
|
||||||
|
do_not_submit=do_not_submit,
|
||||||
)
|
)
|
||||||
|
|
||||||
return credit_note
|
return credit_note
|
||||||
@@ -149,7 +150,9 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# check invoice grand total, invoiced, paid and outstanding column's value after credit note
|
# check invoice grand total, invoiced, paid and outstanding column's value after credit note
|
||||||
self.create_credit_note(si.name)
|
cr_note = self.create_credit_note(si.name, do_not_submit=True)
|
||||||
|
cr_note.update_outstanding_for_self = False
|
||||||
|
cr_note.save().submit()
|
||||||
report = execute(filters)
|
report = execute(filters)
|
||||||
|
|
||||||
expected_data_after_credit_note = [100, 0, 0, 40, -40, self.debit_to]
|
expected_data_after_credit_note = [100, 0, 0, 40, -40, self.debit_to]
|
||||||
@@ -167,6 +170,68 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_cr_note_flag_to_update_self(self):
|
||||||
|
filters = {
|
||||||
|
"company": self.company,
|
||||||
|
"report_date": today(),
|
||||||
|
"range1": 30,
|
||||||
|
"range2": 60,
|
||||||
|
"range3": 90,
|
||||||
|
"range4": 120,
|
||||||
|
"show_remarks": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
# check invoice grand total and invoiced column's value for 3 payment terms
|
||||||
|
si = self.create_sales_invoice(no_payment_schedule=True)
|
||||||
|
name = si.name
|
||||||
|
|
||||||
|
report = execute(filters)
|
||||||
|
|
||||||
|
expected_data = [100, 100, "No Remarks"]
|
||||||
|
|
||||||
|
self.assertEqual(len(report[1]), 1)
|
||||||
|
row = report[1][0]
|
||||||
|
self.assertEqual(expected_data, [row.invoice_grand_total, row.invoiced, row.remarks])
|
||||||
|
|
||||||
|
# check invoice grand total, invoiced, paid and outstanding column's value after payment
|
||||||
|
self.create_payment_entry(si.name)
|
||||||
|
report = execute(filters)
|
||||||
|
|
||||||
|
expected_data_after_payment = [100, 100, 40, 60]
|
||||||
|
self.assertEqual(len(report[1]), 1)
|
||||||
|
row = report[1][0]
|
||||||
|
self.assertEqual(
|
||||||
|
expected_data_after_payment,
|
||||||
|
[row.invoice_grand_total, row.invoiced, row.paid, row.outstanding],
|
||||||
|
)
|
||||||
|
|
||||||
|
# check invoice grand total, invoiced, paid and outstanding column's value after credit note
|
||||||
|
cr_note = self.create_credit_note(si.name, do_not_submit=True)
|
||||||
|
cr_note.posting_date = add_days(today(), 1)
|
||||||
|
cr_note.update_outstanding_for_self = True
|
||||||
|
cr_note.save().submit()
|
||||||
|
report = execute(filters)
|
||||||
|
|
||||||
|
expected_data_after_credit_note = [
|
||||||
|
[100.0, 100.0, 40.0, 0.0, 60.0, self.debit_to],
|
||||||
|
[0, 0, 100.0, 0.0, -100.0, self.debit_to],
|
||||||
|
]
|
||||||
|
self.assertEqual(len(report[1]), 2)
|
||||||
|
for i in range(2):
|
||||||
|
row = report[1][i - 1]
|
||||||
|
# row = report[1][0]
|
||||||
|
self.assertEqual(
|
||||||
|
expected_data_after_credit_note[i - 1],
|
||||||
|
[
|
||||||
|
row.invoice_grand_total,
|
||||||
|
row.invoiced,
|
||||||
|
row.paid,
|
||||||
|
row.credit_note,
|
||||||
|
row.outstanding,
|
||||||
|
row.party_account,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
def test_payment_againt_po_in_receivable_report(self):
|
def test_payment_againt_po_in_receivable_report(self):
|
||||||
"""
|
"""
|
||||||
Payments made against Purchase Order will show up as outstanding amount
|
Payments made against Purchase Order will show up as outstanding amount
|
||||||
|
|||||||
Reference in New Issue
Block a user