Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
3 Відповіді
11840 Переглядів

Hi there,

Does anybody know a clean way to change the default 1-40 limit in a tree view for only one specific view?
In the default Odoo sale order view the sale order lines are shown as a one2many like this:

<page string="Order Lines" name="order_lines">
  <tree string="Sales Order Lines" editable="bottom" decoration-info="(not display_type and invoice_status == 'to invoice')">
    <field name="sequence" widget="handle"/>
    <!-- Loads of other code -->
  </tree>
</page>

The Odoo JS framework by default only shows the first 40 records in list views but what if we want to show the first 100 lines for example? I don't want to override the framework JavaScript and enable this for all one2many trees but only for the tree view in this specific form.
This should only be done on one inline one2many field in a form view and nowhere else.

Any ideas?

Regards,
Yenthe

Аватар
Відмінити
Найкраща відповідь

Hi,

Try limit="x". 

<tree string="Sales Order Lines" editable="bottom" decoration-info="invoice_status=='to invoice'"  limit="42">

While Inheriting:

<xpath expr="//field[@name='order_line']/tree" position="attributes">
<attribute name="limit">42</attribute>
</xpath>


Thanks

Аватар
Відмінити
Автор

Thanks Niyas! It actually looks like setting it on "attrs" doesn't work in the framework for V13 while your answer does. This won't work for example:

<xpath expr="//field[@name='order_line']/tree" position="attributes">

<attribute name="attrs">{'limit': 100}</attribute>

</xpath>

This is just to add more info for future people :)

Thank you both

Найкраща відповідь

Hello 

set the limit on the tree tag. see below example

<field name="one2many_field">
         <tree editable="bottom" limit="300">
                  <field name="name"/>
         </tree>
</field>    

Аватар
Відмінити
Найкраща відповідь

Hi Yenthe:

You can use view inheritance and use the following definition to set the limit attribute of the tree:

<?xml version="1.0"?>
<data inherit_id="sale.view_order_form">
<xpath expr="//field[@name='order_line']/tree" position="attributes">
<attribute name="limit">100</attribute>
</xpath>
</data>
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
бер. 24
1760
1
вер. 21
3110
1
квіт. 16
4432
1
лют. 24
1219
0
квіт. 21
3417