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

Changing a default view

By
Andrew
on 1/19/16, 8:27 AM 736 views

Hi!

I am looking to personalize my Odoo. For this I started working on the Suppliers list available via Purchases --> Purchase --> Suppliers.

By default the view is shown in Kanban view, whereas I prefer List view. This was fixed in the following way:

  1. Go to Settings → Technical → Actions → Window Actions

  2. Find the action with Action Name ‘Suppliers’

  3. Under Views, edit the View Mode parameter from “kanban,tree,form” to “tree,kanban,form”

  4. Click Save

Next, by default the Supplier view lists both companies and persons. I would like to filter on companies only by default. Now I have to edit the search (click downward arrow in search box) and filter on Companies.

  1. I tried the following:

  2. Go to Settings → Technical → Actions → Window Actions

  3. Find the action with Action Name ‘Suppliers’

  4. Under Filters, I changed the Context Value to {'search_default_supplier': 1,'default_customer': 0,'default_supplier': 1,'search_default_is_company': 1} (I added the last item in the dict object; the first 3 were already there)

  5. Click Save

Unfortunately this does not work. Can someone point me in the right direction? Please note that I only have access to the web interface of Odoo. Thanks!

What (partially) works is the following: Go to Settings → Technical → Actions → Window Actions Find the action with Action Name ‘Suppliers’ Under Views, edit the View Mode parameter from “kanban,tree,form” to “tree,kanban,form” Under Filters, edit the Domain Value from “[]” to “[['is_company', '=', 1]]” Downside is that now all persons are no longer present in the underlying data. I guess that what I am asking is the following: if you go to the Suppliers View (Purchases → Purchase → Suppliers) and expand the search box by clicking on the down facing arrow, you are presented with a set of common filter criteria. Of those 'Suppliers' is enabled by default, whereas 'Companies' is not. Where are those filters defined? And where can I set defaults?

Andrew
on 1/19/16, 2:54 PM

Alright, my solution was to do the following: Via GitHub I found out that the view and filters are defined in: odoo/openerp/addons/base/res/res_partner_view.xml The important line here is: To enable this filter by default I added 'search_default_type_company': 1 to the Context Value

Andrew
on 1/19/16, 3:11 PM
1
Akram El Gabry
On 1/19/16, 12:31 PM

Hi when you go into the supplier view, you can see that 'Suppliers' are already selected as a filter. If you select the filter in that screen area you can see you can also select 'Companies'.

Now you want to both save that search and make it your default, you first need to select to save the filter, to do this you must give it a name (I used 'Supplier Companies'), now when you select to save the filter you also get an option to 'Use By Default' (as well as sharing the filter), if you set use by default, this filter will appear every time you go into that view as default.

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: 1/19/16, 8:27 AM
Seen: 736 times
Last updated: 5/10/16, 7:42 AM