コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
16735 ビュー

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

関連投稿 返信 ビュー 活動
3
4月 25
4832
5
11月 23
43192
3
10月 23
8967
3
9月 23
9574
1
9月 23
3403