<field name="arch" type="xml">
<xpath expr="//tree" position="replace">
<tree string="Product" multi_edit="1" default_order="name">
<field name="product_variant_count" invisible="1"/>
<field name="sequence" widget="handle" readonly="1"/>
<field name="default_code" optional="show"/>
<field name="barcode" optional="hide" attrs="{'readonly': [('product_variant_count', '>', 1)]}"/>
<field name="name"/>
<field name="company_id" options="{'no_create_edit': True}" groups="base.group_multi_company"
optional="hide"/>
<field name="list_price" string="Sales Price" optional="show"/>
<field name="standard_price" optional="show" readonly="1"/>
<field name="categ_id" optional="hide"/>
<field name="type" optional="hide" readonly="1"/>
<field name="uom_id" readonly="1" optional="show" groups="uom.group_uom"/>
<field name="active" invisible="1"/>
<field name="activity_exception_decoration" widget="activity_exception"/>
</tree>
</xpath>
</field>
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi just add like this in python file only,
_order = "field_name desc"
or
_order = "field_name asc"
Hi, Osman
It should work. Actually by default it shows the list in ascending order. You can also define to see the changes in descending order like below,
<tree string="Product" multi_edit="1" default_order="name desc">
PS: If you have inheriting the view to set default order then instead of writing whole code for tree view you also write like below,
<xpath expr="//tree" position="attributes">
<attribute name="default_order">name desc</attribute>
</xpath>
Feel free to ask in case you have any doubt related to the above code
Thanks,
Ashish SIngh (Team Lead)
Webkul Software Private Limited
I have tried tow ways ,still not working
Hi, Osman
It should work. Can you please tell me which version of Odoo you are currently using?
Also kindly try the same for "list_price" as well and let me know if it is working for you.
<tree string="Product" multi_edit="1" default_order="list_price desc">
Also it will be helpful if you can share the screenshot.
Thanks,
Ashish Singh
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 10 22
|
3757 | ||
|
0
thg 10 20
|
3139 | ||
|
4
thg 10 19
|
3926 | ||
|
0
thg 8 20
|
3738 | ||
|
2
thg 1 20
|
3874 |