How to extend the limits of records in internal tree view & normal tree view in odoo?

04

Jun

How to extend the limits of records in internal tree view & normal tree view in odoo?

This blog will help you to understand how we can extend the limits of internal tree view and normal tree view.

  1. Internal tree view, which we generally using for the One2many fields.

Here is an example for invoice line, will help you to understand more how we can extend the limit. by default display records limit is 80 per page for any internal tree view.

<record id="extended_limit_invoice_line_tree" model="ir.ui.view">
    <field name="name">extend.limit.invoice.line</field>
    <field name="model">account.invoice</field>
    <field name="inherit_id" ref="account.invoice_form"/>
    <field name="arch" type="xml">
        <xpath expr="//field[@name='invoice_line_ids']/tree" position="attributes">
            <attribute name="limit">100</attribute>
        </xpath>
    </field>
</record>

2. Main tree view, for any model.

Here is an example for invoice , will help you to understand more how we can extend the limit. by default display records limit is 80 per page for any tree view. for the main tree view we need to inherit the action of that model and need to apply there.

<record id="account.action_invoice_tree1" model="ir.actions.act_window">
    <field name="name">Customer Invoices</field>
    <field name="res_model">account.invoice</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
    <field eval="False" name="view_id"/>
    <field name="domain">[('type','in',('out_invoice', 'out_refund'))]</field>
    <field name="context">{'type':'out_invoice', 'journal_type': 'sale'}</field>
    <field name="search_view_id" ref="account.view_account_invoice_filter"/>
    <field name="limit">100</field>
    <field name="help" type="html">
      <p>
        Click to create a customer invoice.
      </p><p>
        Odoo's electronic invoicing allows to ease and fasten the
        collection of customer payments. Your customer receives the
        invoice by email and he can pay online and/or import it
        in his own system.
      </p><p>
        The discussions with your customer are automatically displayed at
        the bottom of each invoice.
      </p>
    </field>
</record>

I hope this article was helpful to you. as I’ve bit struggled in past to find solution for internal tree view limit.

Happy Reading!

Leave a Reply

Your email address will not be published. Required fields are marked *