Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
16690 Weergaven

Hello everyone

I have the following tree view:

<record id="mymodule_customers_tree_view" model="ir.ui.view">
    <field name="name">Customers List</field>
    <field name="model">mymodule.customers</field>
    <field name="arch" type="xml">
      <tree>
              <field name="name"/>
              <field name="address"/>
              <field name="city"/>
       </tree>
    </field>
  </record> 

Everytime I add a new record, on the tree view this new record is shown at the end of the list.

How can change this behavior and add the new records to the top of the list?

Thank you in advance

Avatar
Annuleer
Beste antwoord

Hi,

For this what you can do is that give default_order for the tree view, see the sample,

<tree string="Messages" default_order="id desc">


In your case,


<record id="mymodule_customers_tree_view" model="ir.ui.view">
<field name="name">Customers List</field>
<field name="model">mymodule.customers</field>
<field name="arch" type="xml">
<tree default_order="id desc">
<field name="name"/>
<field name="address"/>
<field name="city"/>
</tree>
</field>
</record>

Thanks

Avatar
Annuleer
Auteur

Thank you Cybrosys.

I think this "id desc" refers to "desc= descendant" is that correct?

Thank you once again. It's working as expected

Gerelateerde posts Antwoorden Weergaven Activiteit
3
apr. 25
4775
5
nov. 23
43137
3
okt. 23
8854
3
sep. 23
9551
1
sep. 23
3343