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.
This commit is contained in:
marination 2023-11-09 12:50:44 +01:00
parent 162c0497d1
commit 56ac3424d2
2 changed files with 8 additions and 5 deletions

View File

@ -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,
)

View File

@ -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)