fix: default due_date was wrong calculated on template "_Test Payment Term Template 1" (last day of next month)
This commit is contained in:
parent
2afed7de03
commit
ce8a1086a7
@ -550,7 +550,7 @@ def get_due_date_from_template(template_name, posting_date, bill_date):
|
||||
elif term.due_date_based_on == "Day(s) after the end of the invoice month":
|
||||
due_date = max(due_date, add_days(get_last_day(due_date), term.credit_days))
|
||||
else:
|
||||
due_date = max(due_date, add_months(get_last_day(due_date), term.credit_months))
|
||||
due_date = max(due_date, get_last_day(add_months(due_date, term.credit_months)))
|
||||
return due_date
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@ from erpnext.stock.doctype.material_request.test_material_request import make_ma
|
||||
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import (
|
||||
make_purchase_invoice as make_pi_from_pr,
|
||||
)
|
||||
from erpnext.accounts.party import get_due_date_from_template
|
||||
|
||||
|
||||
class TestPurchaseOrder(FrappeTestCase):
|
||||
@ -685,6 +686,10 @@ class TestPurchaseOrder(FrappeTestCase):
|
||||
else:
|
||||
raise Exception
|
||||
|
||||
def test_default_payment_terms(self):
|
||||
due_date = get_due_date_from_template("_Test Payment Term Template 1", "2023-02-03")
|
||||
self.assertEqual(due_date, "2023-03-31")
|
||||
|
||||
def test_terms_are_not_copied_if_automatically_fetch_payment_terms_is_unchecked(self):
|
||||
po = create_purchase_order(do_not_save=1)
|
||||
po.payment_terms_template = "_Test Payment Term Template"
|
||||
|
Loading…
x
Reference in New Issue
Block a user