Odoo Help

0

Default view filter Group and Order

By
aj
on 2/29/16, 1:53 PM 2,208 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?

1
Jignesh Mehta
On 3/2/16, 8:14 AM

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,

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 2/29/16, 1:53 PM
Seen: 2208 times
Last updated: 3/2/16, 8:14 AM