From 7a12b80dd20f7cd0581d830f4f91a7c809f10f45 Mon Sep 17 00:00:00 2001 From: Pratik Date: Thu, 22 May 2025 10:50:39 +0000 Subject: [PATCH 01/68] fix: hide selected filters from filter list --- frontend/src/components/Filter.vue | 15 ++++++++++++++- frontend/src/components/ViewControls.vue | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Filter.vue b/frontend/src/components/Filter.vue index ac1c01f0..bb45fb5b 100644 --- a/frontend/src/components/Filter.vue +++ b/frontend/src/components/Filter.vue @@ -126,7 +126,7 @@
@@ -217,6 +217,19 @@ const filters = computed(() => { return convertFilters(filterableFields.data, allFilters) }) +const availableFilters = computed(() => { + if (!filterableFields.data) return [] + + const selectedFieldNames = new Set() + for (const filter of filters.value) { + selectedFieldNames.add(filter.fieldname) + } + + return filterableFields.data.filter( + (field) => !selectedFieldNames.has(field.fieldname), + ) +}) + function removeCommonFilters(commonFilters, allFilters) { for (const key in commonFilters) { if (commonFilters.hasOwnProperty(key) && allFilters.hasOwnProperty(key)) { diff --git a/frontend/src/components/ViewControls.vue b/frontend/src/components/ViewControls.vue index f8730f29..beaf8b99 100644 --- a/frontend/src/components/ViewControls.vue +++ b/frontend/src/components/ViewControls.vue @@ -752,6 +752,7 @@ const quickFilterOptions = computed(() => { let fields = getFields() if (!fields) return [] + let existingQuickFilters = newQuickFilters.value.map((f) => f.fieldname) let restrictedFieldtypes = [ 'Tab Break', 'Section Break', @@ -766,6 +767,7 @@ const quickFilterOptions = computed(() => { ] let options = fields .filter((f) => f.label && !restrictedFieldtypes.includes(f.fieldtype)) + .filter((f) => !existingQuickFilters.includes(f.fieldname)) .map((field) => ({ label: field.label, value: field.fieldname, From b291f82e4de3036032fc2891aece932bde8c9cc1 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 22 May 2025 18:13:07 +0530 Subject: [PATCH 02/68] fix: show communication date instead of creation --- crm/api/activities.py | 2 ++ frontend/src/components/Activities/EmailArea.vue | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crm/api/activities.py b/crm/api/activities.py index 7f6fb689..2753ada7 100644 --- a/crm/api/activities.py +++ b/crm/api/activities.py @@ -124,6 +124,7 @@ def get_deal_activities(name): activity = { "activity_type": "communication", "communication_type": communication.communication_type, + "communication_date": communication.communication_date or communication.creation, "creation": communication.creation, "data": { "subject": communication.subject, @@ -255,6 +256,7 @@ def get_lead_activities(name): activity = { "activity_type": "communication", "communication_type": communication.communication_type, + "communication_date": communication.communication_date or communication.creation, "creation": communication.creation, "data": { "subject": communication.subject, diff --git a/frontend/src/components/Activities/EmailArea.vue b/frontend/src/components/Activities/EmailArea.vue index 61ee2f69..9fcf5e9c 100644 --- a/frontend/src/components/Activities/EmailArea.vue +++ b/frontend/src/components/Activities/EmailArea.vue @@ -22,9 +22,9 @@ variant="subtle" :theme="status.color" /> - +
- {{ __(timeAgo(activity.creation)) }} + {{ __(timeAgo(activity.communication_date)) }}
From b95a17a4e0454268e76f70039a2171bc3f51ba59 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 23 May 2025 20:26:43 +0530 Subject: [PATCH 03/68] fix: set default value as empty array --- frontend/src/components/Controls/TableMultiselectInput.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Controls/TableMultiselectInput.vue b/frontend/src/components/Controls/TableMultiselectInput.vue index a498812b..c3cd8565 100644 --- a/frontend/src/components/Controls/TableMultiselectInput.vue +++ b/frontend/src/components/Controls/TableMultiselectInput.vue @@ -64,7 +64,10 @@ const emit = defineEmits(['change']) const { getFields } = getMeta(props.doctype) -const values = defineModel() +const values = defineModel({ + type: Array, + default: () => [], +}) const valuesRef = ref([]) const error = ref(null) From 8af4e9b5e82a5a3460053fa0fc7b93a704a97084 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 23 May 2025 21:49:12 +0530 Subject: [PATCH 04/68] feat: intercept create lead from call log via form script --- crm/fcrm/doctype/crm_call_log/crm_call_log.py | 17 ++++++++++---- frontend/src/components/FieldLayout/Field.vue | 9 +++++++- .../components/Modals/CallLogDetailModal.vue | 23 +++++++++++++++++-- frontend/src/data/document.js | 9 ++++++++ 4 files changed, 51 insertions(+), 7 deletions(-) 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 e644b6e1..4e3488c6 100644 --- a/crm/fcrm/doctype/crm_call_log/crm_call_log.py +++ b/crm/fcrm/doctype/crm_call_log/crm_call_log.py @@ -190,11 +190,20 @@ def get_call_log(name): @frappe.whitelist() -def create_lead_from_call_log(call_log): +def create_lead_from_call_log(call_log, lead_details=None): lead = frappe.new_doc("CRM Lead") - lead.first_name = "Lead from call " + call_log.get("from") - lead.mobile_no = call_log.get("from") - lead.lead_owner = frappe.session.user + lead_details = frappe.parse_json(lead_details or "{}") + + if not lead_details.get("lead_owner"): + lead_details["lead_owner"] = frappe.session.user + if not lead_details.get("mobile_no"): + lead_details["mobile_no"] = call_log.get("from") or "" + if not lead_details.get("first_name"): + lead_details["first_name"] = "Lead from call " + ( + lead_details.get("mobile_no") or call_log.get("name") + ) + + lead.update(lead_details) lead.save(ignore_permissions=True) # link call log with lead diff --git a/frontend/src/components/FieldLayout/Field.vue b/frontend/src/components/FieldLayout/Field.vue index a190817f..b517d973 100644 --- a/frontend/src/components/FieldLayout/Field.vue +++ b/frontend/src/components/FieldLayout/Field.vue @@ -206,7 +206,7 @@ v-else type="text" :placeholder="getPlaceholder(field)" - :value="data[field.fieldname]" + :value="getDataValue(data[field.fieldname], field)" :disabled="Boolean(field.read_only)" :description="field.description" @change="fieldChange($event.target.value, field)" @@ -340,6 +340,13 @@ function fieldChange(value, df) { triggerOnChange(df.fieldname) } } + +function getDataValue(value, field) { + if (field.fieldtype === 'Duration') { + return value || 0 + } + return value +}