mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-19 14:55:13 +00:00
fix: default due_date was wrong calculated on template "_Test Payment Term Template 1" (last day of next month)
(cherry picked from commit ce8a1086a7)
This commit is contained in:
@@ -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":
|
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))
|
due_date = max(due_date, add_days(get_last_day(due_date), term.credit_days))
|
||||||
else:
|
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
|
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 (
|
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import (
|
||||||
make_purchase_invoice as make_pi_from_pr,
|
make_purchase_invoice as make_pi_from_pr,
|
||||||
)
|
)
|
||||||
|
from erpnext.accounts.party import get_due_date_from_template
|
||||||
|
|
||||||
|
|
||||||
class TestPurchaseOrder(FrappeTestCase):
|
class TestPurchaseOrder(FrappeTestCase):
|
||||||
@@ -685,6 +686,10 @@ class TestPurchaseOrder(FrappeTestCase):
|
|||||||
else:
|
else:
|
||||||
raise Exception
|
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):
|
def test_terms_are_not_copied_if_automatically_fetch_payment_terms_is_unchecked(self):
|
||||||
po = create_purchase_order(do_not_save=1)
|
po = create_purchase_order(do_not_save=1)
|
||||||
po.payment_terms_template = "_Test Payment Term Template"
|
po.payment_terms_template = "_Test Payment Term Template"
|
||||||
|
|||||||
Reference in New Issue
Block a user