mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-23 00:28:30 +00:00
fix: flaky demo test case
(cherry picked from commit 5b1571879c)
Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
This commit is contained in:
@@ -635,9 +635,7 @@ def get_due_date_from_template(template_name, posting_date, bill_date):
|
|||||||
return due_date
|
return due_date
|
||||||
|
|
||||||
|
|
||||||
def validate_due_date(
|
def validate_due_date(posting_date, due_date, bill_date=None, template_name=None):
|
||||||
posting_date, due_date, party_type, party, company=None, bill_date=None, template_name=None
|
|
||||||
):
|
|
||||||
if getdate(due_date) < getdate(posting_date):
|
if getdate(due_date) < getdate(posting_date):
|
||||||
frappe.throw(_("Due Date cannot be before Posting / Supplier Invoice Date"))
|
frappe.throw(_("Due Date cannot be before Posting / Supplier Invoice Date"))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -575,18 +575,12 @@ class AccountsController(TransactionBase):
|
|||||||
validate_due_date(
|
validate_due_date(
|
||||||
self.posting_date,
|
self.posting_date,
|
||||||
self.due_date,
|
self.due_date,
|
||||||
"Customer",
|
|
||||||
self.customer,
|
|
||||||
self.company,
|
|
||||||
self.payment_terms_template,
|
self.payment_terms_template,
|
||||||
)
|
)
|
||||||
elif self.doctype == "Purchase Invoice":
|
elif self.doctype == "Purchase Invoice":
|
||||||
validate_due_date(
|
validate_due_date(
|
||||||
self.bill_date or self.posting_date,
|
self.bill_date or self.posting_date,
|
||||||
self.due_date,
|
self.due_date,
|
||||||
"Supplier",
|
|
||||||
self.supplier,
|
|
||||||
self.company,
|
|
||||||
self.bill_date,
|
self.bill_date,
|
||||||
self.payment_terms_template,
|
self.payment_terms_template,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -149,6 +149,11 @@ def convert_order_to_invoices():
|
|||||||
invoice.set_posting_time = 1
|
invoice.set_posting_time = 1
|
||||||
invoice.posting_date = order.transaction_date
|
invoice.posting_date = order.transaction_date
|
||||||
invoice.due_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.update_stock = 1
|
||||||
invoice.submit()
|
invoice.submit()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user