Community mailing list archives

community@mail.odoo.com

Re: Need Help on 'Tree view' order

by
cysnake4713
- 03/11/2015 08:03:03


Thank you for your answers! the 'default_order' one solve the problem!

Though Openerp V7 do not support default_order setting,  in ODOO v8,
It works wonderfully, I test it in two ways:

1. Directly use in tree view, like this:

<field name="arch" type="xml">
    <tree default_order="origin_plan desc">
        <field name="origin_plan"/>
        <field name="target_plan"/>
        <field name="result_origin_plan"/>
        <field name="result_target_plan"/>
    </tree>
</field>

2. Use in sub view, It's still working! like is:

<field name="cell_ids" nolabel="1">
    <tree editable="top" default_order="lesson desc">
        <field name="classroom"/>
        <field name="subject"/>
        <field name="teacher"/>
        <field name="week"/>
        <field name="lesson"/>
    </tree>
</field>

2015-03-10 6:18 GMT+08:00 Nicolas Schmitt <n.schmitt@protelcotelsa.com>:
Quoting the doc present there: https://www.odoo.com/documentation/8.0/reference/views.html#lists

default_order: overrides the ordering of the view,
replacing the model’s default order.
The value is a comma-separated list of fields,
postfixed by desc to sort in reverse order:

    

I have never tried it though.

Please tell us how it goes!

Cordially,
Sathors

On 09/03/15, Zou Haojun wrote:
> You need two make objects if you want two tree view. Each class can only has one _order
> On Mon, Mar 9, 2015 at 11:48 AM, Cy Snake < cysnake4713@gmail.com [1] > wrote:
> Hello guys,
> I defined a model like this:
> XXXX:
> _order = 'create_date desc'
> 
> then, This model have two list views, one need order by 'create_date
> desc' , but another one need order by 'p_date desc' , is ODOO. V8
> surpport this kind of behavior?
> _______________________________________________
> Mailing-List: https://www.odoo.com/groups/community-59 [2]
> Post to: mailto: community@mail.odoo.com [3]
> Unsubscribe: https://www.odoo.com/groups?unsubscribe [4]
> 
> 
> _______________________________________________
> Mailing-List: https://www.odoo.com/groups/community-59
> Post to: mailto:community@mail.odoo.com
> Unsubscribe: https://www.odoo.com/groups?unsubscribe
> 
> 
> 
> [1] mailto:cysnake4713@gmail.com
> [2] https://www.odoo.com/groups/community-59
> [3] mailto:community@mail.odoo.com
> [4] https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe