Skip to content

Commit

Permalink
Merge pull request #39135 from deepeshgarg007/demo_test_case
Browse files Browse the repository at this point in the history
fix: flaky demo test case
  • Loading branch information
deepeshgarg007 authored Jan 4, 2024
2 parents 351ee5b + 5b15718 commit df409d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 1 addition & 3 deletions erpnext/accounts/party.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,7 @@ def get_due_date_from_template(template_name, posting_date, bill_date):
return due_date


def validate_due_date(
posting_date, due_date, party_type, party, company=None, bill_date=None, template_name=None
):
def validate_due_date(posting_date, due_date, bill_date=None, template_name=None):
if getdate(due_date) < getdate(posting_date):
frappe.throw(_("Due Date cannot be before Posting / Supplier Invoice Date"))
else:
Expand Down
6 changes: 0 additions & 6 deletions erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,18 +561,12 @@ def validate_due_date(self):
validate_due_date(
self.posting_date,
self.due_date,
"Customer",
self.customer,
self.company,
self.payment_terms_template,
)
elif self.doctype == "Purchase Invoice":
validate_due_date(
self.bill_date or self.posting_date,
self.due_date,
"Supplier",
self.supplier,
self.company,
self.bill_date,
self.payment_terms_template,
)
Expand Down
5 changes: 5 additions & 0 deletions erpnext/setup/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ def convert_order_to_invoices():
invoice.set_posting_time = 1
invoice.posting_date = order.transaction_date
invoice.due_date = order.transaction_date
invoice.bill_date = order.transaction_date

if invoice.get("payment_schedule"):
invoice.payment_schedule[0].due_date = order.transaction_date

invoice.update_stock = 1
invoice.submit()

Expand Down

0 comments on commit df409d8

Please sign in to comment.