From 56ac3424d22b68bbc551913133803686431d1694 Mon Sep 17 00:00:00 2001 From: marination Date: Thu, 9 Nov 2023 12:50:44 +0100 Subject: [PATCH] fix: Alert message and make sure invoice due dates are different for effective test - Make invoice due dates are different so that the invoice with the earliest due date is allocated first in the test - Translate voucher type, simplify alert message. The invoice could be "split" into 1 row, no. of rows in the message seems unnecessary. --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 4 ++-- .../accounts/doctype/payment_entry/test_payment_entry.py | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index fc6e1f462e..de48b1189b 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1713,8 +1713,8 @@ def split_invoices_based_on_payment_terms(outstanding_invoices, company) -> list continue frappe.msgprint( - _("Spliting {} {} into {} row(s) as per Payment Terms").format( - split_rows[0]["voucher_type"], split_rows[0]["voucher_no"], len(split_rows) + _("Splitting {0} {1} as per Payment Terms").format( + _(entry.voucher_type), frappe.bold(entry.voucher_no) ), alert=True, ) diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py index b3511f0f52..797a363aba 100644 --- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py @@ -1270,7 +1270,10 @@ class TestPaymentEntry(FrappeTestCase): customer = create_customer("Max Mustermann", "INR") create_payment_terms_template() - si = create_sales_invoice(qty=1, rate=100, customer=customer) + # SI has an earlier due date and SI2 has a later due date + si = create_sales_invoice( + qty=1, rate=100, customer=customer, posting_date=add_days(nowdate(), -4) + ) si2 = create_sales_invoice(do_not_save=1, qty=1, rate=100, customer=customer) si2.payment_terms_template = "Test Receivable Template" si2.submit() @@ -1286,8 +1289,8 @@ class TestPaymentEntry(FrappeTestCase): args.update( { "get_outstanding_invoices": True, - "from_posting_date": nowdate(), - "to_posting_date": add_days(nowdate(), 7), + "from_posting_date": add_days(nowdate(), -4), + "to_posting_date": add_days(nowdate(), 2), } ) references = get_outstanding_reference_documents(args)