Search code examples
odooodoo-12

Filter Partners Accounting Report [Odoo12]


I am trying to filter the partner list on an odoo accounting report (Partner Ledger) located on Accounting-> Reporting -> Partner Ledger

enter image description here

I need to set default list to display only customer partner (customer_rank = 1),not all contacts as it is displaying right now.

Is there a way to filter that list?

I was trying to find the view displayed below, but I couldn't find any view to change the context or domain.

enter image description here

Also I tried through JS but I do not see any way to add domain on button (account_reports module).

<div class="col-12">
  <t t-if="options.get('partner_ids') != None">
    Partners:
    <t t-set="res_partner_value">All</t>
    <t t-foreach="options['selected_partner_ids']" t-as="partner_name">
      <t t-set="res_partner_value" t-value="''"/>
      <t t-esc="partner_name"/>
    </t>
    <t t-esc="res_partner_value"/>
  </t>
</div>

Solution

  • I was able to find the solution:

    There is a function on the js file, where you can pass a domain field when creating a widget:

    name: fieldName,
    relation: fieldInfo.modelName,
    type: 'many2many',
    domain: "[('customer_rank','=',1)]",
    value: fieldInfo.value
    

    After adding that, the partner list is filtered as expected.