Calender and gantt chart view added for production order doctype

This commit is contained in:
Neil Trini Lasrado 2014-10-14 18:16:53 +05:30
parent 9d01133e49
commit 712cd7a426
2 changed files with 30 additions and 0 deletions

View File

@ -181,3 +181,19 @@ def make_stock_entry(production_order_id, purpose, qty=None):
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

View File

@ -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"
}