I am working on Odoo 18 and need to modify the Enquiry Screen to display additional counts near the progress bar. The current progress bar already shows the Expected Revenue, but I want to add more details for better visibility.
CHECK THIS IMAGES 👇
For the "NEW" Stage: The display format should be:
525K - 12 (10)
525K → Expected Revenue (already displayed)
12 → Total Enquiries for the Year
(10) → Count of enquiries currently in this stage
For all other stages: The display format should be:
525K - 6
6 → Count of enquiries currently in this stage
I checked the model (crm.lead or similar) but didn’t find an existing field that directly provides the total count of enquiries per year.
I explored the OWL JS components but am unsure how to modify the display logic near the progress bar.
To display an additional count near the progress bar in Odoo 18's Enquiry Screen, follow these steps:
Template Inheritance:
Extend the existing ColumnProgress
template from the crm
module using XML. This allows you to inject custom elements into the progress bar's structure.
XPath Positioning:
Use an XPath expression to target the <AnimatedNumber>
element (which displays the current value) and insert your additional count after it.
Manifest Configuration:
Ensure your module's __manifest__.py
declares a dependency on crm
and loads the XML asset in the backend.
Code Solution:
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<!-- Inherit and extend the CRM progress bar template -->
<t t-inherit="crm.ColumnProgress" t-inherit-mode="extension">
<!-- Insert additional count after the AnimatedNumber element -->
<xpath expr="//AnimatedNumber" position="after">
<span class="ml-2">
<!-- Replace 'your_field' with the actual field name -->
#######
</span>
</xpath>
</t>
</templates>
Manifest File (__manifest__.py
):
{
# ... other manifest keys
'assets': {
'web.assets_backend': [
'your_module/static/src/xml/your_template.xml', # XML asset path
],
},
# ... other manifest keys
}