how to to default group by filter sorting in openerp, if we group records based on some field, it will group the tree view record based on that field, defaultly groupby sorting is assending order how to decending order..

Search views are a new feature of OpenERP supported as of version 6.0 It creates a customized search panel, and is declared quite similarly to a form view, except that the view type and root element change to search instead of form.

Following is the list of new elements and features supported in search views.

Group tag

Unlike form group elements, search view groups support unlimited number of widget(fields or filters) in a row (no automatic line wrapping), and only use the following attributes:

expand: turns on the expander icon on the group (1 for expanded by default, 0 for collapsed)

Filters are displayed as a toggle button on search panel Filter elements can add new values in the current domain or context of the search view. Filters can be added as a child element of field too, to indicate that they apply specifically to that field (in this case the button's icon will smaller)

In the picture above the red area contains filters at the top of the form while the blue area highlights a field and it's child filter.

Above filters groups records sharing the same project_id value. Groups are loaded lazily, so the inner records are only loaded when the group is expanded. The group header lines contain the common values for all records in that group, and all numeric fields currently displayed in the view are replaced by the sum of the values in that group.

It is also possible to group on multiple values by specifying a list of fields instead of a single string. In this case nested groups will be displayed:

The range fields are composed of two input widgets (from and two) instead of just one.

This leads to peculiarities (compared to non-range search fields):

It is not possible to override the operator of a range field via @operator, as the domain is built of two sections and each section uses a different operator.

Instead of being a simple value (integer, string, float) self for use in @filter_domain and @context is a dict.

Because each input widget of a range field can be empty (and the field itself will still be valid), care must be taken when using self: it has two string keys "from" and "to", but any of these keys can be either missing entirely or set to the value False.

Actions for Search view

After declaring a search view, it will be used automatically for all tree views on the same model. If several search views exist for a single model, the one with the highest priority (lowest sequence) will be used. Another option is to explicitly select the search view you want to use, by setting the search_view_id field of the action.

In addition to being able to pass default form values in the context of the action, OpenERP 6.0 now supports passing initial values for search views too, via the context. The context keys need to match the search_default_XXX format. XXX may refer to the name of a <field> or <filter> in the search view (as the name attribute is not required on filters, this only works for filters that have an explicit name set). The value should be either the initial value for search fields, or simply a boolean value for filters, to toggle them

As of v6.0, all search views also features custom search filters, as show below. Users can define their own custom filters using any of the fields available on the current model, combining them with AND/OR operators. It is also possible to save any search context (the combination of all currently applied domain and context values) as a personal filter, which can be recalled at any time. Filters can also be turned into Shortcuts directly available in the User's homepage.

In above screenshot we filter Partner where Salesman = Demo user and Country = Belgium, We can save this search criteria as a Shortcut or save as Filter.

Filters are user specific and can be modified via the Manage Filters option in the filters drop-down.

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