From 981e96be7c54b6bfe07c5a8d6b399c200d945b3f Mon Sep 17 00:00:00 2001 From: pu-raihan Date: Thu, 17 Oct 2024 10:50:17 +0530 Subject: [PATCH 1/5] fix: assigning to new owner and revoking old assignees permissions --- crm/fcrm/doctype/crm_deal/crm_deal.py | 8 +++++--- crm/fcrm/doctype/crm_lead/crm_lead.py | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.py b/crm/fcrm/doctype/crm_deal/crm_deal.py index 395619b7..4d2251cf 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.py +++ b/crm/fcrm/doctype/crm_deal/crm_deal.py @@ -18,9 +18,11 @@ class CRMDeal(Document): def validate(self): self.set_primary_contact() self.set_primary_email_mobile_no() - if self.deal_owner and not self.is_new(): - self.share_with_agent(self.deal_owner) - self.assign_agent(self.deal_owner) + if not self.is_new(): + curr_owner = frappe.db.get_value(self.doctype,self.name,"deal_owner") + if self.deal_owner and self.deal_owner != curr_owner: + self.share_with_agent(self.deal_owner) + self.assign_agent(self.deal_owner) if self.has_value_changed("status"): add_status_change_log(self) diff --git a/crm/fcrm/doctype/crm_lead/crm_lead.py b/crm/fcrm/doctype/crm_lead/crm_lead.py index 75ca04e0..db448c85 100644 --- a/crm/fcrm/doctype/crm_lead/crm_lead.py +++ b/crm/fcrm/doctype/crm_lead/crm_lead.py @@ -21,9 +21,11 @@ class CRMLead(Document): self.set_lead_name() self.set_title() self.validate_email() - if self.lead_owner and not self.is_new(): - self.share_with_agent(self.lead_owner) - self.assign_agent(self.lead_owner) + if not self.is_new(): + curr_owner = frappe.db.get_value(self.doctype,self.name,"lead_owner") + if self.lead_owner and self.lead_owner != curr_owner: + self.share_with_agent(self.lead_owner) + self.assign_agent(self.lead_owner) if self.has_value_changed("status"): add_status_change_log(self) From ef41bc076c150c797505f24474ec54090a2e1251 Mon Sep 17 00:00:00 2001 From: Muhammed Raihan P A <99407382+pu-raihan@users.noreply.github.com> Date: Mon, 21 Oct 2024 08:55:06 -0800 Subject: [PATCH 2/5] Update crm/fcrm/doctype/crm_deal/crm_deal.py Co-authored-by: Shariq Ansari <30859809+shariquerik@users.noreply.github.com> --- crm/fcrm/doctype/crm_deal/crm_deal.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.py b/crm/fcrm/doctype/crm_deal/crm_deal.py index 4d2251cf..dc18c133 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.py +++ b/crm/fcrm/doctype/crm_deal/crm_deal.py @@ -18,11 +18,9 @@ class CRMDeal(Document): def validate(self): self.set_primary_contact() self.set_primary_email_mobile_no() - if not self.is_new(): - curr_owner = frappe.db.get_value(self.doctype,self.name,"deal_owner") - if self.deal_owner and self.deal_owner != curr_owner: - self.share_with_agent(self.deal_owner) - self.assign_agent(self.deal_owner) + if not self.is_new() and self.has_value_changed("deal_owner") and self.deal_owner: + self.share_with_agent(self.deal_owner) + self.assign_agent(self.deal_owner) if self.has_value_changed("status"): add_status_change_log(self) From 0d25867aec13f62166fde1441d8472131b7ec30f Mon Sep 17 00:00:00 2001 From: Muhammed Raihan P A <99407382+pu-raihan@users.noreply.github.com> Date: Mon, 21 Oct 2024 08:55:20 -0800 Subject: [PATCH 3/5] Update crm/fcrm/doctype/crm_lead/crm_lead.py Co-authored-by: Shariq Ansari <30859809+shariquerik@users.noreply.github.com> --- crm/fcrm/doctype/crm_lead/crm_lead.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crm/fcrm/doctype/crm_lead/crm_lead.py b/crm/fcrm/doctype/crm_lead/crm_lead.py index db448c85..632080a9 100644 --- a/crm/fcrm/doctype/crm_lead/crm_lead.py +++ b/crm/fcrm/doctype/crm_lead/crm_lead.py @@ -21,11 +21,9 @@ class CRMLead(Document): self.set_lead_name() self.set_title() self.validate_email() - if not self.is_new(): - curr_owner = frappe.db.get_value(self.doctype,self.name,"lead_owner") - if self.lead_owner and self.lead_owner != curr_owner: - self.share_with_agent(self.lead_owner) - self.assign_agent(self.lead_owner) + if not self.is_new() and self.has_value_changed("lead_owner") and self.lead_owner: + self.share_with_agent(self.lead_owner) + self.assign_agent(self.lead_owner) if self.has_value_changed("status"): add_status_change_log(self) From 4072fd9075018daf784d9b9b1fe77f7284ba026e Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 22 Oct 2024 13:03:31 +0530 Subject: [PATCH 4/5] fix: cannot update email in contact --- frontend/src/components/Modals/ContactModal.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/Modals/ContactModal.vue b/frontend/src/components/Modals/ContactModal.vue index 3872b1fe..e7690682 100644 --- a/frontend/src/components/Modals/ContactModal.vue +++ b/frontend/src/components/Modals/ContactModal.vue @@ -279,7 +279,7 @@ const filteredSections = computed(() => { _contact.value.email_id = option.value } } else { - editOption('Contact Email', option.name, option.value) + editOption('Contact Email', option.name, 'email_id', option.value) } }, onDelete: async (option, isNew) => { @@ -332,7 +332,7 @@ const filteredSections = computed(() => { _contact.value.actual_mobile_no = option.value } } else { - editOption('Contact Phone', option.name, option.value) + editOption('Contact Phone', option.name, 'phone', option.value) } }, onDelete: async (option, isNew) => { @@ -415,11 +415,11 @@ async function createNew(field, value) { } } -async function editOption(doctype, name, value) { +async function editOption(doctype, name, fieldname, value) { let d = await call('frappe.client.set_value', { doctype, name, - fieldname: doctype == 'Contact Phone' ? 'phone' : 'email', + fieldname, value, }) if (d) { From fd23d66ccd10ee5d0472d1debfc50951091d4459 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 24 Oct 2024 20:11:56 +0530 Subject: [PATCH 5/5] fix: email & comments not loading in respective tab --- frontend/src/components/Activities/Activities.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Activities/Activities.vue b/frontend/src/components/Activities/Activities.vue index f4613998..2a3f3dd6 100644 --- a/frontend/src/components/Activities/Activities.vue +++ b/frontend/src/components/Activities/Activities.vue @@ -652,12 +652,12 @@ const activities = computed(() => { _activities = get_activities() } else if (title.value == 'Emails') { if (!all_activities.data?.versions) return [] - activities = all_activities.data.versions.filter( + _activities = all_activities.data.versions.filter( (activity) => activity.activity_type === 'communication', ) } else if (title.value == 'Comments') { if (!all_activities.data?.versions) return [] - activities = all_activities.data.versions.filter( + _activities = all_activities.data.versions.filter( (activity) => activity.activity_type === 'comment', ) } else if (title.value == 'Calls') {