Odoo Help

Welcome!

This community 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.

0

Default view filter Group and Order

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

--Jignesh Mehta--
2087
| 6 4 8
Surat, India
--Jignesh Mehta--


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,

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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