validations added to production order
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index a962248..67b53f6 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -35,6 +35,7 @@
self.validate_sales_order()
self.validate_warehouse()
self.calculate_operating_cost()
+ self.validate_delivery_date()
from erpnext.utilities.transaction_base import validate_uom_is_integer
validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"])
@@ -219,6 +220,13 @@
else:
self.actual_start_date = None
self.actual_end_date = None
+
+ def validate_delivery_date(self):
+ if self.planned_start_date and self.expected_delivery_date and getdate(self.expected_delivery_date) < getdate(self.planned_start_date):
+ frappe.throw(_("Expected Delivery Date cannot be greater than Planned Start Date"))
+
+ if self.planned_end_date and self.expected_delivery_date and getdate(self.expected_delivery_date) < getdate(self.planned_end_date):
+ frappe.msgprint(_("Production might not be able to finish by the Expected Delivery Date."))
@frappe.whitelist()
def get_item_details(item):