Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
8676 Widoki

hello i need to set list view as default view on product

Awatar
Odrzuć
Najlepsza odpowiedź

At the bottom of the Window Action you will see a list of Views (for some Menus where there are none, Odoo will use the defaults).

The View at the top will be shown first, so if you want the LIST instead of the KANBAN, drag the LIST to the top.

For more information see https://www.odoo.com/forum/help-1/odoo10-how-to-set-the-tree-list-view-as-default-view-for-customers-and-products-in-sales-module-129021 


(although this post is for Odoo 10 it is applicable for all versions of Odoo)

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

This is the action for the product view,

<record id="product_template_action_product" model="ir.actions.act_window">

        <field name="name">Products</field>

        <field name="type">ir.actions.act_window</field>

        <field name="res_model">product.template</field>

        <field name="view_mode">kanban,tree,form</field>

        <field name="view_type">form</field>

        <field name="search_view_id" ref="product_template_search_form_view_stock"/>

        <field name="context">{"search_default_consumable": 1, 'default_type': 'product'}</field>

        <field name="help" type="html">

            <p class="o_view_nocontent_smiling_face">

                Create a new product

            </p>

        </field>

    </record> 

1. Here in view_mode is Kanban is given first and then followed by tree and then form.

2 .You can change this to  <field name="view_mode">tree,form,kanban</field>  to set default     tree view mode when you select the product button.
3. But you need to inherit this view in your custom module and then change it. For this you     can just copy the above code and give the module reference before the action in id.


<record id="stock.product_template_action_product" model="ir.actions.act_window">

.....

 <field name="view_mode">tree,form,kanban</field>
.....

</record> 


And make sure you give the dependency of the stock module in your manifest file.

Hope it helps,

Thanks





Awatar
Odrzuć
Najlepsza odpowiedź

Believe that you want to set a default list for the product.template,

You can inherit the action and change the sequence of the view_mode.

<record id="product.product_template_action_all" model="ir.actions.act_window">

       <field name="view_mode">tree,kanban,form</field>

</record>

Awatar
Odrzuć
Autor

thanks