Adding Calendar view for Opportunity
This commit is contained in:
parent
c4c44a9a2b
commit
9ee8110411
@ -336,3 +336,27 @@ def make_opportunity_from_communication(communication, ignore_communication_link
|
|||||||
link_communication_to_document(doc, "Opportunity", opportunity.name, ignore_communication_links)
|
link_communication_to_document(doc, "Opportunity", opportunity.name, ignore_communication_links)
|
||||||
|
|
||||||
return opportunity.name
|
return opportunity.name
|
||||||
|
@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("Opportunity", filters)
|
||||||
|
|
||||||
|
data = frappe.db.sql("""
|
||||||
|
select
|
||||||
|
distinct `tabOpportunity`.name, `tabOpportunity`.customer_name, `tabOpportunity`.opportunity_amount,
|
||||||
|
`tabOpportunity`.title, `tabOpportunity`.contact_date
|
||||||
|
from
|
||||||
|
`tabOpportunity`
|
||||||
|
where
|
||||||
|
(`tabOpportunity`.contact_date between %(start)s and %(end)s)
|
||||||
|
{conditions}
|
||||||
|
""".format(conditions=conditions), {
|
||||||
|
"start": start,
|
||||||
|
"end": end
|
||||||
|
}, as_dict=True, update={"allDay": 0})
|
||||||
|
return data
|
||||||
@ -7,6 +7,13 @@ frappe.views.calendar["Opportunity"] = {
|
|||||||
"id": "name",
|
"id": "name",
|
||||||
"title": "customer_name",
|
"title": "customer_name",
|
||||||
"allDay": "allDay"
|
"allDay": "allDay"
|
||||||
},
|
},
|
||||||
get_events_method: 'frappe.desk.doctype.event.event.get_events'
|
options: {
|
||||||
|
header: {
|
||||||
|
left: 'prev,next today',
|
||||||
|
center: 'title',
|
||||||
|
right: 'month'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
get_events_method: 'erpnext.crm.doctype.opportunity.opportunity.get_events'
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user