From a79bc4d35abbfb7597d7c01dbdb4f4cb798eeff6 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:37:57 +0530 Subject: [PATCH] fix: Unnecessary validation for non deferred sales invoices (#43816) fix: Unnecessary validation for non deferred sales invoices (#43816) (cherry picked from commit af472054f6a8f77aca8811e3f575893ba7ea1c00) Co-authored-by: Deepesh Garg (cherry picked from commit bf4fb53575be594e2e13e0c53cd4218fe4215ac5) --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index c680bd461308..ebdbb01fdc27 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -297,8 +297,11 @@ def validate(self): self.update_current_stock() self.validate_delivery_note() + is_deferred_invoice = any(d.get("enable_deferred_revenue") for d in self.get("items")) + # validate service stop date to lie in between start and end date - validate_service_stop_date(self) + if is_deferred_invoice: + validate_service_stop_date(self) if not self.is_opening: self.is_opening = "No"