Перейти к содержимому
Odoo Меню
  • Войти
  • Попробовать бесплатно
  • Модули
    Финансы
    • Бухгалтерия
    • Выставление счетов
    • Расходы
    • Таблицы
    • Документооборот
    • Подпись
    Продажи
    • CRM
    • Продажи
    • POS Магазин
    • POS Ресторан
    • Подписки
    • Аренда
    Вебсайты
    • Конструктор вебсайтов
    • eCommerce
    • Блог
    • Форум
    • Онлайн-чат
    • Электронное обучение
    Логистика
    • Склад
    • Производство
    • PLM
    • Закупки
    • Обслуживание
    • Качество
    Отдел кадров
    • Сотрудники
    • Подбор персонала
    • Отпуска
    • Оценка персонала
    • Реферальная программа
    • Автопарк
    Маркетинг
    • SMM
    • E-mail рассылки
    • СМС рассылки
    • Мероприятия
    • Автоматизация маркетинга
    • Опросы
    Услуги
    • Проекты
    • Табели
    • Выездной сервис
    • Поддержка
    • Планирование
    • Встречи
    Продуктивность
    • Обсуждения
    • Согласование
    • IoT
    • VoIP-телефония
    • Knowledge
    • WhatsApp
    Сторонние приложения Модуль Студия Odoo Платформа Odoo Cloud
  • Индустрии
    Розничная торговля
    • Книжный магазин
    • Магазин одежды
    • Мебельный магазин
    • Продуктовый магазин
    • Строительный магазин
    • Магазин игрушек
    Гостинично-ресторанный бизнес
    • Бар и паб
    • Ресторан
    • Фастфуд
    • Гостевой дом
    • Дистрибьютор напитков
    • Отель
    Недвижимость
    • Агентство недвижимости
    • Архитектурное бюро
    • Строительство
    • Управление недвижимостью
    • Ландшафтный дизайн
    • Товарищество собственников жилья
    Консалтинг
    • Бухгалтерская фирма
    • Партнер Odoo
    • Маркетинговое агентство
    • Юридическая фирма
    • Подбор персонала
    • Аудиторское бюро
    Производство
    • Текстиль
    • Металл
    • Мебель
    • Продукты питания
    • Пивоварня
    • Корпоративные сувениры
    Здоровье и фитнес
    • Спортивный комплекс
    • Магазин оптики
    • Фитнес-клуб
    • Велнес-центр
    • Аптека
    • Салон красоты
    Услуги
    • Специалист по бытовым услугам
    • Продажа и обслуживание IT-оборудования
    • Солнечные энергосистемы
    • Производство обуви
    • Клининг
    • Системы ОВКВ
    Прочее
    • Некоммерческая организация
    • Консалтинг в сфере устойчивого развития
    • Аренда рекламных щитов
    • Бизнес по фотосъемке
    • Прокат велосипедов
    • Реселлер программного обеспечения
    Все индустрии
  • Community
    Обучение
    • Видео уроки
    • Документация
    • Сертификация
    • Тренинг
    • Блог
    • Подкаст
    Образование и развитие
    • Образовательная программа
    • Деловая игра Scale Up!
    • Экскурсия в офис Odoo
    ПО
    • Скачать
    • Сравнить версии
    • Релизы
    Сотрудничество
    • Github
    • Форум
    • Мероприятия
    • Перевод
    • Стать партнером
    • Услуги для партнеров
    • Зарегистрировать бухгалтерскую фирму
    Услуги
    • Найти партнера
    • Найти бухгалтера
    • Встреча с экспертом
    • Услуги по внедрению
    • Отзывы клиентов
    • Поддержка
    • Обновления
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Заказать демонстрацию
  • Цены
  • Поддержка

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

  • CRM
  • e-Commerce
  • Бухгалтерия
  • Склад
  • PoS
  • Проекты
  • MRP
All apps
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Помощь

Add custom filter in financial reports odoo17

Подписаться

Получайте уведомления о появлении активности в этом посте

Этот вопрос был отмечен
accountingodoo
3 Ответы
7434 Представления
Аватар
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
Аватар
Отменить
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.

Аватар
Abdel-Fatah
Лучший ответ

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
Аватар
Отменить
Аватар
Gracious Joseph
Лучший ответ

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
Аватар
Отменить
Не оставайтесь в стороне – присоединяйтесь к обсуждению!

Создайте аккаунт сегодня, чтобы получить доступ к эксклюзивным функциям и стать частью нашего замечательного сообщества!

Регистрация
Похожие посты Ответы Просмотры Активность
concatenate another field with label in account.move.line Решено
accounting odoo
Аватар
Аватар
1
авг. 24
4960
Aged Receivable report total amount is different in general ledger account odoo14
accounting odoo
Аватар
0
сент. 21
4278
Problems installing chart of accounts
accounting odoo
Аватар
0
мар. 15
6098
Accounting app on localhost Решено
accounting installation odoo
Аватар
Аватар
Аватар
Аватар
3
мая 25
7828
Odoo 9 - Back up entire accounting / sales / etc
accounting backup odoo
Аватар
Аватар
2
мая 24
1917
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • Github
  • Runbot
  • Перевод
Услуги
  • Хостинг Odoo.sh
  • Поддержка
  • Обновление
  • Индивидуальные решения по доработке
  • Образование
  • Найти бухгалтера
  • Найти партнера
  • Стать партнером
О нас
  • Наша компания
  • Активы бренда
  • Cвяжитесь с нами
  • Вакансии
  • Мероприятия
  • Подкаст
  • Блог
  • Клиенты
  • Правовые документы • Конфиденциальность
  • Безопасность
الْعَرَبيّة 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 – это набор бизнес-модулей с открытым исходным кодом, который закроет все потребности вашей компании: CRM, E-commerce, Бухгалтерия, Склад, POS, управление проектами и др.

Odoo сочетает в себе простоту использования и полную интеграцию всех бизнес-процессов в одной системе.

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