Calender and gantt chart view added for production order doctype
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index fbca0d5..8386133 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -181,3 +181,19 @@
stock_entry.get_items()
return stock_entry.as_dict()
+
+@frappe.whitelist()
+def get_events(start, end):
+ from frappe.desk.reportview import build_match_conditions
+ if not frappe.has_permission("Production Order"):
+ frappe.msgprint(_("No Permission"), raise_exception=1)
+
+ data = frappe.db.sql("""select name,production_item, start_date,end_date from `tabProduction Order`
+ where ((ifnull(start_date, '0000-00-00')!= '0000-00-00') \
+ and (start_date between %(start)s and %(end)s) \
+ or ((ifnull(start_date, '0000-00-00')!= '0000-00-00') \
+ and end_date between %(start)s and %(end)s))""", {
+ "start": start,
+ "end": end
+ }, as_dict=True, update={"allDay": 0})
+ return data
diff --git a/erpnext/manufacturing/doctype/production_order/production_order_calendar.js b/erpnext/manufacturing/doctype/production_order/production_order_calendar.js
new file mode 100644
index 0000000..68bbc28
--- /dev/null
+++ b/erpnext/manufacturing/doctype/production_order/production_order_calendar.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+frappe.views.calendar["Production Order"] = {
+ field_map: {
+ "start": "start_date",
+ "end": "end_date",
+ "id": "name",
+ "title": "production_item",
+ "allDay": "allDay"
+ },
+ gantt: true,
+ get_events_method: "erpnext.manufacturing.doctype.production_order.production_order.get_events"
+}
\ No newline at end of file