Skip to Content
Menu
This question has been flagged
3 Replies
3363 Views

Hi  Everyone,


i try to add a search field in the product tree view (product.product_template_tree_view) in order to find all products with same price, in any price lists!!!!!!

And when i'll fill the search field with, for example, 100, i will obtain :

"Search price for : 100"


Hope you can help

Vincent


Avatar
Discard
Best Answer

Hello, Vincent!

In order to this, you have to inherit the search view, and add the field with a filter_domain attribute specified to your needs. The reason why I used self because that will contain the value that is typed in the search bar.

Do this:

<record id="product_template_search_view_inherit" model="ir.ui.view">
<field name="name">product.template.search.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<xpath expr="//search/field[1]" position="before">    
            <!-- lst_price is the field for the Public Price -->    
<field name="lst_price" filter_domain="[('lst_price', '=', self)]"/>
</xpath>
</field>
</record>


This is what it looks like:


Results:

Avatar
Discard
Author

Thank you for your answer Serge

I know this syntax and use it for other research

But in that case, i have to find a product by its price in a pricelist, not sale price but extra price!

To give you more details :

In a sale order, when you click "add a product" (with popup)

In the popup, in the field Product, you choose "Search more..."

And in the treeview, i want to find a product by its price in the pricelist of the customer choosen in the sale order

There is already a column 'price' with the good price according to the customer choosen.

I tried to add the line below in the view : product.product_search_form_view

<field name="price" string="Prix d'une liste de prix" filter_domain="[('price', '=', self)]"/>

The option is display but the research doesn't works

Did you mean the Sales Price column?

Author

No i mean the "price" column between "Cost" and "Quantity on hand" columns.

But the column "price" is display only if there is a pricelist (if i well understood this line in the view product.product_product_tree_view : <field name="price" invisible="not context.get('pricelist',False)"/>)

"price" is a computed column wich call "_compute_product_price" in product.py

In fact, i think this field is filled dynamically according the choosen customer

How do you display the 'price' field? I can't show mine even though I enabled it.

Author

I think to display this column, you have to activate price list

In settings, in sale module, activate "Pricelists" and choose one of the 2 options (advanced prices rules for my part)

Otherwise, just note that it is displayed only in the search treeview when you are looking for a product from the sale.order.line popup

To have the popup, you need to add those lines in an inherited view of sale.view_order_form :

<xpath expr="//field[@name='order_line']/tree" position="attributes">

<attribute name="editable"/>

</xpath>

Follow this :

In a sale order, when you click "add a product" (with popup)

In the popup, in the field Product, you choose "Search more..."

And in the other popup with all product in a tree view, you will have (for my case) a column "price"

Best Answer

Hello Vincent,

You can do the following code to add the Price field in search view then after you can search product by its price

    <!--Inherit product template search view-->

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

      <field name="name">sale.order.search.expand</field>

      <field name="model">sale.order</field>

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

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

        <xpath expr="//search" position="inside">

          <!-- This field will show up on the quick search -->

            <field name="list_price" string="Price" />

        </xpath>

      </field>

    </record>

Thank You!


Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

Avatar
Discard
Author

Hello Jainesh,

it works on the column sale prices but i don't want to search on this column but on the column 'price' of the treeview.

You can read my answers with Serge Mercado

Thank you

Best Answer

In order to see that, you have to add a Filter.

Go to Products> Filters> Add Custom Filter> Select Sales Price/ Cost/ Public Price (whichever you need to search for) > Select is equal to> Put the Price (For Example 100) and Apply

Hope this will help you.

How can you automate your manufacturing processes? Sign up for our next webinar to know more!


Pritee Pallavi Behera

Odoo Consultant

Tel: +353 1 886 5684 (IE) +44 121 285 5684 (UK)  +91 964 381 7554 (IN)

 

Target Integration | CRM ERP Cloud

Website | LinkedIn | Twitter | Facebook | YouTube | Instagram

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 23
236
1
Dec 22
2412
1
Jun 22
1976
1
Jan 22
1344
0
Mar 15
4918