validations added to production order

This commit is contained in:
Neil Trini Lasrado 2015-02-11 14:35:52 +05:30
parent 8fa503e177
commit 87402df56a

View File

@ -35,6 +35,7 @@ class ProductionOrder(Document):
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 @@ class ProductionOrder(Document):
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):