fix: heatmap not working for customer and supplier (#21578)
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
parent
8e08698c15
commit
5210761e57
@ -465,23 +465,25 @@ def get_timeline_data(doctype, name):
|
|||||||
from frappe.desk.form.load import get_communication_data
|
from frappe.desk.form.load import get_communication_data
|
||||||
|
|
||||||
out = {}
|
out = {}
|
||||||
fields = 'date(creation), count(name)'
|
fields = 'creation, count(*)'
|
||||||
after = add_years(None, -1).strftime('%Y-%m-%d')
|
after = add_years(None, -1).strftime('%Y-%m-%d')
|
||||||
group_by='group by date(creation)'
|
group_by='group by Date(creation)'
|
||||||
|
|
||||||
data = get_communication_data(doctype, name, after=after, group_by='group by date(creation)',
|
data = get_communication_data(doctype, name, after=after, group_by='group by creation',
|
||||||
fields='date(C.creation) as creation, count(C.name)',as_dict=False)
|
fields='C.creation as creation, count(C.name)',as_dict=False)
|
||||||
|
|
||||||
# fetch and append data from Activity Log
|
# fetch and append data from Activity Log
|
||||||
data += frappe.db.sql("""select {fields}
|
data += frappe.db.sql("""select {fields}
|
||||||
from `tabActivity Log`
|
from `tabActivity Log`
|
||||||
where (reference_doctype="{doctype}" and reference_name="{name}")
|
where (reference_doctype=%(doctype)s and reference_name=%(name)s)
|
||||||
or (timeline_doctype in ("{doctype}") and timeline_name="{name}")
|
or (timeline_doctype in (%(doctype)s) and timeline_name=%(name)s)
|
||||||
or (reference_doctype in ("Quotation", "Opportunity") and timeline_name="{name}")
|
or (reference_doctype in ("Quotation", "Opportunity") and timeline_name=%(name)s)
|
||||||
and status!='Success' and creation > {after}
|
and status!='Success' and creation > {after}
|
||||||
{group_by} order by creation desc
|
{group_by} order by creation desc
|
||||||
""".format(doctype=frappe.db.escape(doctype), name=frappe.db.escape(name), fields=fields,
|
""".format(fields=fields, group_by=group_by, after=after), {
|
||||||
group_by=group_by, after=after), as_dict=False)
|
"doctype": doctype,
|
||||||
|
"name": name
|
||||||
|
}, as_dict=False)
|
||||||
|
|
||||||
timeline_items = dict(data)
|
timeline_items = dict(data)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user