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"