Skip to Content
Menu
This question has been flagged
1 Reply
16654 Views

Hi.

I'm trying without success order and group by a tree view.
I defined action window with this context:

context="{'order_by':'start_datetime desc', 'group_by':'start_datetime:day'}"

I get a grouped tree view by day but not with the inverse order.

Can't group and order fields on and unfiltered view pressing header column buttons and grouping.

¿Posible bug in data.js?

Avatar
Discard
Best Answer

Hello Aj,


For order_by, You can write when your model is define

Ex:-

class CustomClass(models.Model):

     _name = 'custom.class'

     _order = 'start_datetime desc'

For group_by, You can write search record for start_datetime

Ex:-

<record id="custom_class_search_view" model="ir.ui.view">

    <field name="name">custom.class.search.view</field>

    <field name="model">custom.class</field>

    <field name="arch" type="xml">

        <search string="Custom Class">       

            <filter name="group_start_datetime" string="Start time icon="terp-partner" context="{'group_by':'start_datetime'}"/>

        </search>

    </field>

</record>


Now You can pass in context of action as follow :-

<field name="context">{'search_default_group_start_datetime': 1}</field>


Hope it helps you.

Thanks,

Avatar
Discard
Related Posts Replies Views Activity
0
Jan 21
1371
2
Aug 18
2825
1
Jul 16
12673
0
Mar 15
3886
3
May 24
3971