mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
chore: added test for Fetch Overdue Payments in dunning
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
|
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
# See license.txt
|
# See license.txt
|
||||||
|
import json
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
|
from frappe.model import mapper
|
||||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||||
from frappe.utils import add_days, nowdate, today
|
from frappe.utils import add_days, nowdate, today
|
||||||
|
|
||||||
@@ -77,6 +80,36 @@ class TestDunning(IntegrationTestCase):
|
|||||||
dunning.reload()
|
dunning.reload()
|
||||||
self.assertEqual(dunning.status, "Resolved")
|
self.assertEqual(dunning.status, "Resolved")
|
||||||
|
|
||||||
|
def test_fetch_overdue_payments(self):
|
||||||
|
"""
|
||||||
|
Create SI with overdue payment. Check if overdue payment is fetched in Dunning.
|
||||||
|
"""
|
||||||
|
si1 = create_sales_invoice_against_cost_center(
|
||||||
|
posting_date=add_days(today(), -1 * 6),
|
||||||
|
qty=1,
|
||||||
|
rate=100,
|
||||||
|
)
|
||||||
|
|
||||||
|
si2 = create_sales_invoice_against_cost_center(
|
||||||
|
posting_date=add_days(today(), -1 * 6),
|
||||||
|
qty=1,
|
||||||
|
rate=300,
|
||||||
|
)
|
||||||
|
|
||||||
|
dunning = create_dunning_from_sales_invoice(si1.name)
|
||||||
|
dunning.overdue_payments = []
|
||||||
|
|
||||||
|
method = "erpnext.accounts.doctype.sales_invoice.sales_invoice.create_dunning"
|
||||||
|
updated_dunning = mapper.map_docs(method, json.dumps([si1.name, si2.name]), dunning)
|
||||||
|
|
||||||
|
self.assertEqual(len(updated_dunning.overdue_payments), 2)
|
||||||
|
|
||||||
|
self.assertEqual(updated_dunning.overdue_payments[0].sales_invoice, si1.name)
|
||||||
|
self.assertEqual(updated_dunning.overdue_payments[0].outstanding, si1.outstanding_amount)
|
||||||
|
|
||||||
|
self.assertEqual(updated_dunning.overdue_payments[1].sales_invoice, si2.name)
|
||||||
|
self.assertEqual(updated_dunning.overdue_payments[1].outstanding, si2.outstanding_amount)
|
||||||
|
|
||||||
def test_dunning_and_payment_against_partially_due_invoice(self):
|
def test_dunning_and_payment_against_partially_due_invoice(self):
|
||||||
"""
|
"""
|
||||||
Create SI with first installment overdue. Check impact of Dunning and Payment Entry.
|
Create SI with first installment overdue. Check impact of Dunning and Payment Entry.
|
||||||
|
|||||||
Reference in New Issue
Block a user