diff --git a/crm/api/doc.py b/crm/api/doc.py index a6d1b163..282ebe8d 100644 --- a/crm/api/doc.py +++ b/crm/api/doc.py @@ -185,7 +185,8 @@ def get_quick_filters(doctype: str): if field.fieldtype == "Select" and options and isinstance(options, str): options = options.split("\n") options = [{"label": option, "value": option} for option in options] - options.insert(0, {"label": "", "value": ""}) + if not any([not option.get("value") for option in options]): + options.insert(0, {"label": "", "value": ""}) quick_filters.append( { "label": _(field.label), diff --git a/crm/fcrm/doctype/crm_call_log/crm_call_log.py b/crm/fcrm/doctype/crm_call_log/crm_call_log.py index 42388085..880413e1 100644 --- a/crm/fcrm/doctype/crm_call_log/crm_call_log.py +++ b/crm/fcrm/doctype/crm_call_log/crm_call_log.py @@ -155,7 +155,38 @@ def get_call_log(name): "creation", ], ).as_dict() - return parse_call_log(call) + + call = parse_call_log(call) + + notes = [] + tasks = [] + + if call.get("note"): + note = frappe.get_cached_doc("FCRM Note", call.get("note")).as_dict() + notes.append(note) + + if call.get("reference_doctype") and call.get("reference_docname"): + if call.get("reference_doctype") == "CRM Lead": + call["_lead"] = call.get("reference_docname") + elif call.get("reference_doctype") == "CRM Deal": + call["_deal"] = call.get("reference_docname") + + if call.get("links"): + for link in call.get("links"): + if link.get("link_doctype") == "CRM Task": + task = frappe.get_cached_doc("CRM Task", link.get("link_name")).as_dict() + tasks.append(task) + elif link.get("link_doctype") == "FCRM Note": + note = frappe.get_cached_doc("FCRM Note", link.get("link_name")).as_dict() + notes.append(note) + elif link.get("link_doctype") == "CRM Lead": + call["_lead"] = link.get("link_name") + elif link.get("link_doctype") == "CRM Deal": + call["_deal"] = link.get("link_name") + + call["_tasks"] = tasks + call["_notes"] = notes + return call @frappe.whitelist() diff --git a/frontend/src/components/Modals/CallLogModal.vue b/frontend/src/components/Modals/CallLogModal.vue index 4fcd0940..9136c154 100644 --- a/frontend/src/components/Modals/CallLogModal.vue +++ b/frontend/src/components/Modals/CallLogModal.vue @@ -83,13 +83,7 @@ -