fixes for capacity planning using production planning tool

This commit is contained in:
Neil Trini Lasrado 2015-02-16 18:47:58 +05:30
parent a6c361c00e
commit 7182d349df
2 changed files with 12 additions and 6 deletions

View File

@ -222,11 +222,14 @@ class ProductionOrder(Document):
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."))
if self.docstatus==1:
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):

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, flt, cint, nowdate, add_days, comma_and
from frappe.utils import cstr, flt, cint, nowdate, now, add_days, comma_and
from frappe import msgprint, _
@ -218,6 +218,9 @@ class ProductionPlanningTool(Document):
for key in items:
pro = frappe.new_doc("Production Order")
pro.update(items[key])
pro.planned_start_date = now()
pro.set_production_order_operations()
frappe.flags.mute_messages = True
try: