From 5955c06855996b05d130d6fc9689135d3b29597e Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 20 Jun 2024 15:05:15 +0530 Subject: [PATCH] fix: pass currency also get currency every where --- crm/api/contact.py | 1 + crm/fcrm/doctype/crm_deal/crm_deal.py | 1 + .../doctype/crm_organization/crm_organization.py | 1 + .../src/components/Modals/OrganizationModal.vue | 13 +++++++++---- frontend/src/pages/Contact.vue | 5 ++++- frontend/src/pages/Deals.vue | 13 ++++++++----- frontend/src/pages/Organization.vue | 13 +++++++++++-- frontend/src/pages/Organizations.vue | 7 +++++-- 8 files changed, 40 insertions(+), 14 deletions(-) diff --git a/crm/api/contact.py b/crm/api/contact.py index 2f52f433..8ef93e43 100644 --- a/crm/api/contact.py +++ b/crm/api/contact.py @@ -73,6 +73,7 @@ def get_linked_deals(contact): fields=[ "name", "organization", + "currency", "annual_revenue", "status", "email", diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.py b/crm/fcrm/doctype/crm_deal/crm_deal.py index 901f2179..83615ab0 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.py +++ b/crm/fcrm/doctype/crm_deal/crm_deal.py @@ -178,6 +178,7 @@ class CRMDeal(Document): "annual_revenue", "status", "email", + "currency", "mobile_no", "deal_owner", "sla_status", diff --git a/crm/fcrm/doctype/crm_organization/crm_organization.py b/crm/fcrm/doctype/crm_organization/crm_organization.py index 6d9a2a14..471d0f51 100644 --- a/crm/fcrm/doctype/crm_organization/crm_organization.py +++ b/crm/fcrm/doctype/crm_organization/crm_organization.py @@ -47,6 +47,7 @@ class CRMOrganization(Document): "organization_logo", "website", "industry", + "currency", "annual_revenue", "modified", ] diff --git a/frontend/src/components/Modals/OrganizationModal.vue b/frontend/src/components/Modals/OrganizationModal.vue index a051166c..9e94ff6d 100644 --- a/frontend/src/components/Modals/OrganizationModal.vue +++ b/frontend/src/components/Modals/OrganizationModal.vue @@ -61,9 +61,11 @@ diff --git a/frontend/src/pages/Contact.vue b/frontend/src/pages/Contact.vue index bcc0f766..02bb60e6 100644 --- a/frontend/src/pages/Contact.vue +++ b/frontend/src/pages/Contact.vue @@ -357,7 +357,10 @@ function getDealRowObject(deal) { label: deal.organization, logo: getOrganization(deal.organization)?.organization_logo, }, - annual_revenue: formatNumberIntoCurrency(deal.annual_revenue), + annual_revenue: formatNumberIntoCurrency( + deal.annual_revenue, + deal.currency, + ), status: { label: deal.status, color: getDealStatus(deal.status)?.iconColorClass, diff --git a/frontend/src/pages/Deals.vue b/frontend/src/pages/Deals.vue index 0aba6daa..2debed3f 100644 --- a/frontend/src/pages/Deals.vue +++ b/frontend/src/pages/Deals.vue @@ -109,7 +109,7 @@ const rows = computed(() => { if (!deals.value?.data.group_by_field?.name) return [] return getGroupedByRows( deals.value?.data.data, - deals.value?.data.group_by_field + deals.value?.data.group_by_field, ) } else { return parseRows(deals.value?.data.data) @@ -158,7 +158,10 @@ function parseRows(rows) { logo: getOrganization(deal.organization)?.organization_logo, } } else if (row == 'annual_revenue') { - _rows[row] = formatNumberIntoCurrency(deal.annual_revenue) + _rows[row] = formatNumberIntoCurrency( + deal.annual_revenue, + deal.currency, + ) } else if (row == 'status') { _rows[row] = { label: deal.status, @@ -171,8 +174,8 @@ function parseRows(rows) { deal.sla_status == 'Failed' ? 'red' : deal.sla_status == 'Fulfilled' - ? 'green' - : 'orange' + ? 'green' + : 'orange' if (value == 'First Response Due') { value = __(timeAgo(deal.response_by)) tooltipText = dateFormat(deal.response_by, dateTooltipFormat) @@ -207,7 +210,7 @@ function parseRows(rows) { } } else if ( ['first_response_time', 'first_responded_on', 'response_by'].includes( - row + row, ) ) { let field = row == 'response_by' ? 'response_by' : 'first_responded_on' diff --git a/frontend/src/pages/Organization.vue b/frontend/src/pages/Organization.vue index 89f3c2b8..96f9e473 100644 --- a/frontend/src/pages/Organization.vue +++ b/frontend/src/pages/Organization.vue @@ -104,7 +104,12 @@ class="flex items-center gap-1.5" > - {{ formatNumberIntoCurrency(organization.doc.annual_revenue) }} + {{ + formatNumberIntoCurrency( + organization.doc.annual_revenue, + organization.doc.currency, + ) + }} { return organizations.value?.data?.data?.find( - (organization) => organization.name === route.params.organizationId + (organization) => organization.name === route.params.organizationId, ) }) @@ -124,7 +124,10 @@ const rows = computed(() => { } else if (row === 'website') { _rows[row] = website(organization.website) } else if (row === 'annual_revenue') { - _rows[row] = formatNumberIntoCurrency(organization.annual_revenue) + _rows[row] = formatNumberIntoCurrency( + organization.annual_revenue, + organization.currency, + ) } else if (['modified', 'creation'].includes(row)) { _rows[row] = { label: dateFormat(organization[row], dateTooltipFormat),