Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

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

  • CRM
  • e-Commerce
  • Kế toán
  • Tồn kho
  • PoS
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

Add custom filter in financial reports odoo17

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
accountingodoo
3 Trả lời
7382 Lượt xem
Ảnh đại diện
Asmaa

I 'm trying to add custom filter to balance sheet report and profit and loss report in odoo 17
I added the following code :



i added this code in filter.xml in this path:
hat_account_report_multi_currency\static\src\components\hat_account_report_multi_currency\filters.xml
and i added te following code in manifest file:
'assets': {
'web.assets_backend': [
'hat_account_report_multi_currency/static/src/components/**/*',
],
},
but there is nothing appears in the report

0
Ảnh đại diện
Huỷ bỏ
Mahmoud Magdy

Did you find any solution for it ?

Waqas Zia

Has anyone got guide to add in additional data column to the Aged Receivable reports. How does that work out? and how do we add similar dropdown in Aged Receivable reports.

Ảnh đại diện
Abdel-Fatah
Câu trả lời hay nhất

Not like this you need to do 3 things in js and xml and py 
i think that you want currency filter will be like 
lets start with js we need extend AccountReportFilters to use our new template which we inherit it to add our new filter
xml like you did 
<?xml version="1.0" encoding="UTF-8" ?>
<templates> 
​<t t-name="your_module_name.ExtendedAccountReportFilters" t- ​ ​inherit="account_reports.AccountReportFiltersCustomizable"> 

​ ​<xpath expr="//div[@id='filter_extra_options']" position="before"> <t t-if="'currency' in controller.options"> 

​ ​ ​<Dropdown togglerClass="'btn btn-secondary'"> <t t-set-slot="toggler"> <i class="fa fa-folder-open me-1"/>Currencies </t> <MultiRecordSelector t-props="getMultiRecordSelectorProps('res.currency', 'currency_ids')"/> 

​ ​</Dropdown> 

​</t> 
 </xpath> 
 </t>
</templates>

and in js 

/** @odoo-module **/
import { AccountReport } from "@account_reports/components/account_report/account_report";
import { AccountReportFilters } from "@account_reports/components/account_report/filters/filters";
export class ExtendedAccountReportFilters extends AccountReportFilters { 
  ​static template = 'your_module_name.ExtendedAccountReportFilters';

  ​setup() { 
  ​ ​super.setup();
  ​}
}
AccountReport.registerCustomComponent(ExtendedAccountReportFilters);

	​	​	​this new component to make odoo use our new template 
lets go to python side 
first inherit account.report 

class AccountReport(models.Model): 
​ _inherit = 'account.report'
​ filter_currency = fields.Boolean(string="Currencies",compute=lambda x: x._compute_report_option_filter('filter_currency'), readonly=False, store=True, depends=['root_report_id', 'section_main_report_ids'],)
##################################################### 
OPTIONS: currencys 
####################################################
​​def _init_options_currency(self, options, previous_options=None): 
​ ​if not self.filter_currency: 
​ ​ ​return 
​ ​options['currency'] = True 
​ ​previous_currency_ids = previous_options and previous_options.get('currency_ids') or []
​ ​​selected_currency_ids = [int(currency) for currency in previous_currency_ids]  
​ ​selected_currencys = selected_currency_ids and self.env['res.currency'].with_context(active_test=False).search([('id', 'in', selected_currency_ids)]) or self.env['res.currency'] ​ ​ ​
​ ​options['selected_currency_ids'] = selected_currencys.mapped('name')  ​
​@api.model 
​def _get_options_currency_domain(self, options): 
​ ​​domain = [] 
​ ​if options.get('currency_ids'): 
​ ​ ​ currency_ids = [int(currency) for currency in options['currency_ids']] ​ ​ ​ ​               
​ ​ ​domain.append(('currency_id', 'in', currency_ids)) ​ ​ 
​ ​return domain
​​def _get_options_domain(self, options, date_scope): 
​ ​domain = super()._get_options_domain(options, date_scope) 
​ ​domain += self._get_options_city_domainoptions)  
​ ​domain += self._get_options_currency_domain(options) 
​ ​return domain

and in report you want we will inherit it's handler and override _get_custom_display_config func like to make odoo you our component


from odoo import models, fields, api 
class AccountPartnerLedgerReportHandler(models.AbstractModel): 
​_inherit = 'account.partner.ledger.report.handler' ​
​def _get_custom_display_config(self): 
​ ​return { 'css_custom_class': 'partner_ledger',
​ ​ ​ ​'templates': ​{'AccountReportLineName':'account_reports.PartnerLedgerLineName',}, 
​ ​ ​ ​ 'components': {'AccountReportFilters': 'your_module_name.ExtendedAccountReportFilters',}}
 
last thing in in account.report form we need add currency_filter field to check it to show filter

<?xml version="1.0" encoding="utf-8"?>
<odoo> 
 <!-- View account.report form --> 
​<record id="view_account_report_form" model="ir.ui.view"> 
​<field name="name">view.account.report.form</field> 
​<field name="model">account.report</field> 
​<field name="inherit_id" ref="account_reports.account_report_form"/> 
​<field name="arch" type="xml"> 
​ ​<xpath expr="//field[@name='filter_partner']" position="after"> 
​ ​​<field name="filter_currency" /> 
​ ​</xpath> 
​</field> 
​ </record>
</odoo>
0
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Gracious Joseph
Câu trả lời hay nhất

From your screenshot and description, you are trying to add a custom dropdown filter in financial reports like the Balance Sheet and Profit and Loss reports in Odoo 17. However, it seems the filter is not appearing as expected. Here’s how you can troubleshoot and implement it correctly:

1. Verify the Inherited Template

You are inheriting the account_reports.AccountReportFiltersCustomizable template, which is correct. Ensure that:

  • The template ID is correct.
  • The XPath expression accurately targets the desired location in the template.

Your XPath:

<xpath expr="//div[@id='filter_date']" position="before">

Checklist:

  • Open the Odoo developer tools in your browser.
  • Inspect the DOM structure of the filters section in the financial report to confirm the filter_date ID exists.
  • Ensure there are no typos or missing elements.

If the ID filter_date is dynamic or not found, try targeting a broader or adjacent parent element.

Example:

<xpath expr="//div[contains(@class, 'o_account_reports_filter')]//div[1]" position="before">

2. Ensure the Dropdown Component is Correct

You are using a Dropdown component, which appears to be a custom or Odoo-provided widget. Verify that:

  • The Dropdown component is correctly defined in your codebase.
  • Any dependencies required by the component are loaded properly.

For debugging, replace the dropdown with static HTML to check if it appears:

<div id="curr" class="curr">
    <button class="btn btn-secondary">Test Dropdown</button>
</div>

If this appears, the issue is likely with the Dropdown component configuration.

3. Validate Asset Loading

Ensure the assets are correctly declared and loaded:

  • Manifest File Configuration:
    'assets': {
        'web.assets_backend': [
            'hat_account_report_multi_currency/static/src/components/**/*',
        ],
    },
    
    Confirm the path matches your file structure. The wildcard **/* includes all files under components.
  • Rebuild Odoo Assets: After making changes to the manifest, rebuild assets to ensure they are properly loaded:
    ./odoo-bin -c odoo.conf --dev=assets
    
  • Check Browser Console: Open the browser developer tools and check for errors or missing assets.

4. Confirm Template Usage

The financial reports might use specific rendering logic for filters. Confirm that:

  • The account_reports.AccountReportFiltersCustomizable template is used for Balance Sheet and Profit and Loss reports.
  • The inheritance chain is correctly applied.

5. Test Component Integration

Add debugging logs or a simple placeholder message to verify the component is rendered:

<div id="curr" class="curr">
    <p>Custom filter test message</p>
</div>

If this doesn’t appear, your XPath or asset declaration might be incorrect.

6. Add the Custom Filter Logic

If the dropdown is successfully displayed but doesn’t affect the report, implement the filter logic in the corresponding account.report model.

For example:

  1. Add a Field for the Filter: Add a field to handle the filter's value in the backend:
    class AccountReport(models.AbstractModel):
        _inherit = 'account.report'
    
        filter_currency = fields.Many2one('res.currency', string="Currency Filter")
    
  2. Update the Report Values: Override the _get_report_values method to include the custom filter's logic:
    def _get_report_values(self, docids, data):
        report_values = super()._get_report_values(docids, data)
        if data.get('filter_currency'):
            # Add custom filtering logic here
            report_values['currency_filter'] = data['filter_currency']
        return report_values
    
  3. Pass Filter Value from Frontend to Backend: Use JavaScript to handle the dropdown selection and pass the selected value to the report.

7. Testing

  1. Reload the Odoo server and activate developer mode.
  2. Check if the filter appears in the financial reports.
  3. Test the functionality by applying different filter values.

Common Debugging Tips:

  • Check Logs: Look for any server-side or frontend errors in the browser console or Odoo logs.
  • Inspect DOM: Ensure your XML changes are reflected in the DOM.
  • Minimal Testing: Use a simple <div> to verify if the XPath and template inheritance work.

Let me know if you need further assistance!

-1
Ảnh đại diện
Huỷ bỏ
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!

Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!

Đăng ký
Bài viết liên quan Trả lời Lượt xem Hoạt động
concatenate another field with label in account.move.line Đã xử lý
accounting odoo
Ảnh đại diện
Ảnh đại diện
1
thg 8 24
4928
Aged Receivable report total amount is different in general ledger account odoo14
accounting odoo
Ảnh đại diện
0
thg 9 21
4267
Problems installing chart of accounts
accounting odoo
Ảnh đại diện
0
thg 3 15
6068
Accounting app on localhost Đã xử lý
accounting installation odoo
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
3
thg 5 25
7808
Odoo 9 - Back up entire accounting / sales / etc
accounting backup odoo
Ảnh đại diện
Ảnh đại diện
2
thg 5 24
1903
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة 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 là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

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