diff --git a/crm/api/contact.py b/crm/api/contact.py
index 2f52f4331..8ef93e435 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/api/doc.py b/crm/api/doc.py
index 0159c6630..a1a7bb403 100644
--- a/crm/api/doc.py
+++ b/crm/api/doc.py
@@ -257,17 +257,18 @@ def get_list_data(
"user": frappe.session.user,
}
+ _list = get_controller(doctype)
+
if not custom_view and frappe.db.exists("CRM View Settings", default_view_filters):
list_view_settings = frappe.get_doc("CRM View Settings", default_view_filters)
columns = frappe.parse_json(list_view_settings.columns)
rows = frappe.parse_json(list_view_settings.rows)
is_default = False
- elif not custom_view or is_default:
- _list = get_controller(doctype)
+ elif not custom_view or is_default and hasattr(_list, "default_list_data"):
+ columns = _list.default_list_data().get("columns")
- if hasattr(_list, "default_list_data"):
- columns = _list.default_list_data().get("columns")
- rows = _list.default_list_data().get("rows")
+ if hasattr(_list, "default_list_data"):
+ rows = _list.default_list_data().get("rows")
# check if rows has all keys from columns if not add them
for column in columns:
diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.json b/crm/fcrm/doctype/crm_deal/crm_deal.json
index 9e9818d31..e5c973d8c 100644
--- a/crm/fcrm/doctype/crm_deal/crm_deal.json
+++ b/crm/fcrm/doctype/crm_deal/crm_deal.json
@@ -31,6 +31,7 @@
"job_title",
"column_break_xbyf",
"territory",
+ "currency",
"annual_revenue",
"industry",
"person_section",
@@ -72,7 +73,8 @@
"fetch_from": ".annual_revenue",
"fieldname": "annual_revenue",
"fieldtype": "Currency",
- "label": "Amount"
+ "label": "Amount",
+ "options": "currency"
},
{
"fetch_from": ".website",
@@ -327,11 +329,17 @@
"fieldtype": "Link",
"label": "Contact",
"options": "Contact"
+ },
+ {
+ "fieldname": "currency",
+ "fieldtype": "Link",
+ "label": "Currency",
+ "options": "Currency"
}
],
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2024-06-19 18:01:59.213811",
+ "modified": "2024-06-20 12:55:41.602364",
"modified_by": "Administrator",
"module": "FCRM",
"name": "CRM Deal",
diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.py b/crm/fcrm/doctype/crm_deal/crm_deal.py
index 901f21793..83615ab05 100644
--- a/crm/fcrm/doctype/crm_deal/crm_deal.py
+++ b/crm/fcrm/doctype/crm_deal/crm_deal.py
@@ -178,6 +178,7 @@ def default_list_data():
"annual_revenue",
"status",
"email",
+ "currency",
"mobile_no",
"deal_owner",
"sla_status",
diff --git a/crm/fcrm/doctype/crm_organization/crm_organization.json b/crm/fcrm/doctype/crm_organization/crm_organization.json
index bc1a042ce..ce4247635 100644
--- a/crm/fcrm/doctype/crm_organization/crm_organization.json
+++ b/crm/fcrm/doctype/crm_organization/crm_organization.json
@@ -9,6 +9,7 @@
"field_order": [
"organization_name",
"no_of_employees",
+ "currency",
"annual_revenue",
"organization_logo",
"column_break_pnpp",
@@ -47,7 +48,8 @@
{
"fieldname": "annual_revenue",
"fieldtype": "Currency",
- "label": "Annual Revenue"
+ "label": "Annual Revenue",
+ "options": "currency"
},
{
"fieldname": "industry",
@@ -60,12 +62,18 @@
"fieldtype": "Link",
"label": "Territory",
"options": "CRM Territory"
+ },
+ {
+ "fieldname": "currency",
+ "fieldtype": "Link",
+ "label": "Currency",
+ "options": "Currency"
}
],
"image_field": "organization_logo",
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2024-01-19 21:53:14.945857",
+ "modified": "2024-06-20 12:59:55.297752",
"modified_by": "Administrator",
"module": "FCRM",
"name": "CRM Organization",
diff --git a/crm/fcrm/doctype/crm_organization/crm_organization.py b/crm/fcrm/doctype/crm_organization/crm_organization.py
index 6d9a2a143..471d0f512 100644
--- a/crm/fcrm/doctype/crm_organization/crm_organization.py
+++ b/crm/fcrm/doctype/crm_organization/crm_organization.py
@@ -47,6 +47,7 @@ def default_list_data():
"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 a051166c2..9e94ff6d6 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 bcc0f7665..02bb60e66 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 0aba6daa9..2debed3f4 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 89f3c2b8b..96f9e4732 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),
diff --git a/frontend/src/utils/index.js b/frontend/src/utils/index.js
index d0833229e..104f66dbd 100644
--- a/frontend/src/utils/index.js
+++ b/frontend/src/utils/index.js
@@ -94,12 +94,12 @@ export function secondsToDuration(seconds) {
return `${hours}h ${minutes}m ${_seconds}s`
}
-export function formatNumberIntoCurrency(value) {
+export function formatNumberIntoCurrency(value, currency = 'INR') {
if (value) {
return value.toLocaleString('en-IN', {
- maximumFractionDigits: 2,
+ maximumFractionDigits: 0,
style: 'currency',
- currency: 'INR',
+ currency: currency ? currency : 'INR',
})
}
return ''