İçereği Atla
Menü
Bu soru işaretlendi
6 Cevaplar
7742 Görünümler

I want to remove can be sold filter in product and want to add next default filter for product .what should i do? Any body answer me...

Avatar
Vazgeç

Inherit the search view of product and replace that filter with blank.

Üretici

Like this....<xpath expr="/search/filter[@name='filter_to_sell']" position="replace"> <filter/>

Üretici

ok....How to add next default filter

En İyi Yanıt

It's just overview how you can inherit the search view and put new filter default,

first inherit the search view in which your filter resides like,

<record id="inherited_product_search_form_view" model="ir.ui.view">
            <field name="name">product.search.form.inherit</field>
            <field name="model">product.product</field>
            <field name="type">search</field>
            <field name="inherit_id" ref="product.product_search_form_view"/>
            <field name="arch" type="xml">
                <xpath expr="//filter[string='can be sold']" position= 'replace'><!--need to find the x-path -->
                    <filter string="Default filter" name="new_filter" icon="terp-accessories-archiver-minus" domain="[NEW DOMAIN]"/>
                </xpath>
            </field>
            </record>

then you need to update the action like

<record id="product.product_normal_action_sell" model="ir.actions.act_window">
    <field name="name">Products</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">product.product</field>
    <field name="view_mode">tree,form,kanban</field>
    <field name="view_type">form</field>
    <field name="context">{"search_default_new_filter":1}</field>
    <field name="view_id" ref="product_product_tree_view"/>  
    <field name="search_view_id" ref="product_search_form_view"/>            
    <field name="help">You must define a Product for everything you buy or sell. Products can be raw materials, stockable products, consumables or services. The Product form contains detailed information about your products related to procurement logistics, sales price, product category, suppliers and so on.</field>
</record>

Hope This will help!

Avatar
Vazgeç
Üretici

Thanks a lot....I OK

En İyi Yanıt

Inherit  product search view like this::


</record>

</field>

</xpath> 

<xpath expr="//filter[@name='filter_to_sell']" position= 'replace'>

<field name="arch" type="xml"> 

<field name="inherit_id" ref="product.product_template_search_view"/>

<field name="type">search</field> 

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

<field name="name">product.search.form.inherit</field> 

<record id="inherited_product_search_form_view" model="ir.ui.view">


Then the action is just remove the context

<record id="product.product_template_action" 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="view_id" ref="product.product_template_kanban_view"/>

</record>

Avatar
Vazgeç