Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
16696 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
ผู้เขียน

Thank you Cybrosys.

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

Thank you once again. It's working as expected

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
เม.ย. 25
4777
5
พ.ย. 23
43141
3
ต.ค. 23
8863
Create dynamic tree view แก้ไขแล้ว
3
ก.ย. 23
9551
1
ก.ย. 23
3345