İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
16738 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
Üretici

Thank you Cybrosys.

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

Thank you once again. It's working as expected

İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Nis 25
4835
5
Kas 23
43193
3
Eki 23
8971
3
Eyl 23
9574
1
Eyl 23
3403