Calendar View in Quotation List

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
image

Could anyone help me?

Thanks in advance!

Did you run bench build after saving the files?

should be quotation_calendar.js, all in lower case.

1 Like

I completly forgot rsrsrs
But now i did and nothing has change

bench requirements
bench build

changed that still nothing :frowning:

what I have done

  1. copied sales_order_calendar.js to my fisher_test apps public\js folder
  2. changed the doctype name from Sales Order to Quotation
  3. added the hooks as below
  4. build js via bench build --app fisher_test --force
  5. restart bench via sodu supervisorctl restart all