Hello!
I´m Trying to enable an calendar view, based on a fild called inicio_esperado_do_evento
on Quotation.py I inserted
@frappe.whitelist()
def get_events(start, end, filters=None):
"""Returns events for Gantt / Calendar view rendering.
:param start: Start date-time.
:param end: End date-time.
:param filters: Filters (JSON).
"""
from frappe.desk.calendar import get_event_conditions
conditions = get_event_conditions("Quotation", filters)
data = frappe.db.sql("""
select
distinct `tabQuotation`.name, `tabQuotation`.customer_name, `tabQuotation`.inicio_esperado_do_evento,
`tabQuotation`.termino_esperado_do_evento
from
`tabQuotation`, `tabQuotation Item`
where `tabQuotation`.name = `tabQuotation Item`.parent
and (ifnull(`tabQuotation Item`.inicio_esperado_do_evento, '0000-00-00')!= '0000-00-00') \
and (`tabQuotation Item`.inicio_esperado_do_evento between %(start)s and %(end)s)
or ((ifnull(`tabQuotation Item`.termino_esperado_do_evento, '0000-00-00')!= '0000-00-00') \
and e`tabQuotation Item`.termino_esperado_do_evento >= %(start)s))
""".format(conditions=conditions), {
"start": start,
"end": end
}, as_dict=True, update={"allDay": 0})
return data
On Quotation_calendar.js
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.views.calendar["Quotation"] = {
field_map: {
"start": "inicio_esperado_do_evento",
"end": "termino_esperado_do_evento",
"id": "name",
"title": "customer_name",
"allDay": "allDay"
},
gantt: true,
{
"fieldtype": "Link",
"fieldname": "customer",
"options": "Customer",
"label": __("Customer")
},
],
get_events_method: "erpnext.selling.doctype.quotation.quotation.get_events",
}
But no matter what I do i can´t get the calendar View on my Quotation form
Could anyone help me?
Thanks in advance!