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>
Did you find any solution for it ?
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.