Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Add custom dropdown in all Odoo 17.0 financial reports.

Subscribe

Get notified when there's activity on this post

This question has been flagged
developmentaccountingfinancialodoo17.0
3 Replies
3158 Views
Avatar
Mauricio Alejandro Gonzalez

Hi, I want to add or create a new filter/search option in the Odoo financial reports.


For example, in the Odoo financial report Balance Sheet, i tried to inherit the existing template and add a new filterlike this example:


	​	​
<?xml version="1.0" encoding="UTF-8" ?>
<templates>
<t t-name="l10n_ve_reports.AccountReportCurrencySelect" t-inherit="account_reports.AccountReportFiltersCustomizable">
<xpath expr="//div[@id='filter_extra_options']" position="after">
​ ​ ​<div id="multi_currency_selection">
​ ​ ​<p>My EXAMPLE</p>​
​ ​ ​</div>
</xpath>
</t>
</templates>

I added my example as above, and put it on __manifest__ . py, but nothing changed in all my templates.

I want to add a new dropdown to select a currency, but for now, I just want to be able to display a dropdown.

Can someone help me with this? Thanks before hand.

0
Avatar
Discard
Mahmoud Magdy

Did you add it successfully ?  

Avatar
Pedro Dom
Best Answer

https://apps.odoo.com/apps/modules/18.0/odoo_accounting_filters

0
Avatar
Discard
Avatar
Gracious Joseph
Best Answer

To add a custom dropdown filter (e.g., for currency selection) in Odoo 17.0 financial reports, you need to properly inherit the relevant XML templates and integrate the dropdown into the report filter system. Here's how you can achieve this:

Step-by-Step Solution

1. Identify the Correct Template to Inherit

Odoo financial reports use the account_reports.AccountReportFiltersCustomizable template for filters. Ensure you are targeting the correct template and its structure.

2. Create a Custom Module

If you haven't already, create a custom module to house your changes.

Directory structure:

custom_financial_report_filter/
├── __init__.py
├── __manifest__.py
├── views/
│   └── financial_report_filter.xml

3. Update the __manifest__.py File

Define your module and include the dependency on account_reports.

{
    'name': 'Custom Financial Report Filters',
    'version': '1.0',
    'depends': ['account_reports'],
    'author': 'Your Name',
    'data': [
        'views/financial_report_filter.xml',
    ],
    'installable': True,
    'application': False,
}

4. Inherit the Template and Add Your Dropdown

Create the financial_report_filter.xml file to extend the financial report filters.

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
    <template id="add_custom_currency_filter" inherit_id="account_reports.AccountReportFiltersCustomizable">
        <xpath expr="//div[@id='filter_extra_options']" position="inside">
            <div class="form-group" id="multi_currency_selection">
                <label for="currency_dropdown">Select Currency:</label>
                <select id="currency_dropdown" class="form-control">
                    <option value="USD">USD</option>
                    <option value="EUR">EUR</option>
                    <option value="GBP">GBP</option>
                </select>
            </div>
        </xpath>
    </template>
</odoo>

5. Add Backend Logic to Handle the Dropdown

To make the dropdown functional, you need to pass the selected value to the report:

  1. Override Report Action: Modify the action context to include the selected currency value.
  2. Extend account.report Model: Add custom logic to handle the selected currency in the report.
    Example Python code:
    from odoo import models, fields
    
    class AccountReport(models.AbstractModel):
        _inherit = 'account.report'
    
        filter_currency = fields.Selection([
            ('USD', 'USD'),
            ('EUR', 'EUR'),
            ('GBP', 'GBP'),
        ], string="Currency", default='USD')
    
        def _get_report_values(self, docids, data):
            # Add custom logic to filter based on currency
            if self.filter_currency:
                data['currency'] = self.filter_currency
            return super(AccountReport, self)._get_report_values(docids, data)
    

6. Update the JavaScript (Optional)

If you want the dropdown to dynamically update the report without reloading, you can use JavaScript to handle the interaction.

  1. Add a JS File: Create a JS file to add dynamic behavior.
    Example:
    odoo.define('custom_financial_report_filter.CurrencyDropdown', function (require) {
        "use strict";
    
        const publicWidget = require('web.public.widget');
    
        publicWidget.registry.CurrencyDropdown = publicWidget.Widget.extend({
            selector: '#multi_currency_selection',
            events: {
                'change #currency_dropdown': '_onCurrencyChange',
            },
            _onCurrencyChange: function (ev) {
                const selectedCurrency = $(ev.target).val();
                // Send an AJAX request to reload the report
                console.log('Selected currency:', selectedCurrency);
            },
        });
    });
    
  2. Include the JS File in Your Module: Update the __manifest__.py to include the JS file.

7. Test Your Changes

  1. Restart your Odoo server and upgrade the module:
    ./odoo-bin -u custom_financial_report_filter
    
  2. Open the financial reports (e.g., Balance Sheet) and verify that the dropdown is displayed and functional.

Key Notes

  • Ensure Proper Dependencies: Your custom module must depend on account_reports for proper inheritance.
  • Test in Developer Mode: Use Odoo's developer mode to debug template inheritance and confirm the dropdown is rendered correctly.
  • Dynamic Behavior: If you need the dropdown to update results dynamically, you'll need to implement AJAX handling in your JavaScript.

By following these steps, you can add a custom dropdown to Odoo 17.0 financial reports. Let me know if you need further clarification or assistance!

0
Avatar
Discard
Avatar
Nikhil Dhiman
Best Answer

We’ve already developed this for one of our customers. Connect with us to learn more. 

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Restrict QWeb Report in Print Menu to Vendor Payments Only in Odoo 17
development accounting
Avatar
Avatar
1
Oct 25
739
Blank Page After Logged in. Solved
development odoo
Avatar
Avatar
Avatar
2
Sep 25
4499
Error in followup report
development accounting
Avatar
Avatar
1
Aug 25
1831
How can I set it up so that the purchase_price (‘Cost’) field can also be changed in the ‘posted’ status in Model:'account.move'?
development accounting
Avatar
Avatar
1
Jul 25
2711
Dashboard Journal Balances Incorrect After Restoring Odoo 17 CE to docker
accounting 17.0
Avatar
0
Jun 25
1690
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now