diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 7cdb6df153e..cf752afc9d0 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -759,12 +759,11 @@ class TestSalesInvoice(unittest.TestCase): self.assertRaises(SerialNoDuplicateError, si.cancel) def test_invoice_due_date_against_customers_credit_days(self): - si = create_sales_invoice() # set customer's credit days frappe.db.set_value("Customer", "_Test Customer", "credit_days_based_on", "Fixed Days") frappe.db.set_value("Customer", "_Test Customer", "credit_days", 10) - si.validate() + si = create_sales_invoice() self.assertEqual(si.due_date, add_days(nowdate(), 10)) # set customer's credit days is last day of the next month diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 1f655df79ec..0bf014b4d66 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -164,7 +164,7 @@ def get_due_date(posting_date, party_type, party, company): """Set Due Date = Posting Date + Credit Days""" due_date = None if posting_date and party: - due_date = nowdate() + due_date = posting_date if party_type=="Customer": credit_days_based_on, credit_days = get_credit_days(party_type, party, company) if credit_days_based_on == "Fixed Days" and credit_days: