From 3caf462c6b42b9c8d5b8b0a407c54c749474a334 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 17:44:24 +0530 Subject: [PATCH] fix: flaky demo test case (backport #39135) (#39198) fix: flaky demo test case (cherry picked from commit 5b1571879cdb7859725bda2b0d32d9a4f57676e8) Co-authored-by: Deepesh Garg --- erpnext/accounts/party.py | 4 +--- erpnext/controllers/accounts_controller.py | 6 ------ erpnext/setup/demo.py | 5 +++++ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 67446e11af..a3fdf36cbd 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -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: diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 5cc051b936..7986c3d480 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -575,18 +575,12 @@ class AccountsController(TransactionBase): 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, ) diff --git a/erpnext/setup/demo.py b/erpnext/setup/demo.py index 4bc98b91bd..df2c49b2b6 100644 --- a/erpnext/setup/demo.py +++ b/erpnext/setup/demo.py @@ -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()