[IMP] product: search on internal reference
authorMartin Trigaux <mat@odoo.com>
Mon, 3 Nov 2014 14:59:17 +0000 (15:59 +0100)
committerMartin Trigaux <mat@odoo.com>
Mon, 3 Nov 2014 15:05:49 +0000 (16:05 +0100)
When searching on the name of a product.template, search also on the default_code. Move the filter from product.product to product.template.
The field default_code is on the product.product but accessible through a related field, meaning when reading it will fetch only the first variant but searching on all variants.
Fixes #3399

addons/product/product_view.xml

index d2c1633..0f03ff5 100644 (file)
@@ -10,7 +10,7 @@
             <field name="model">product.template</field>
             <field name="arch" type="xml">
                 <search string="Product">
-                    <field name="name" string="Product"/>
+                    <field name="name" string="Product" filter_domain="['|',('default_code','ilike',self),('name','ilike',self)]"/>
                     <filter string="Services" name="services" domain="[('type','=','service')]"/>
                     <filter string="Consumable" name="consumable" icon="terp-accessories-archiver" domain="[('type','=','consu')]" help="Consumable products"/>
                     <separator/>
             <field name="mode">primary</field>
             <field name="inherit_id" ref="product.product_template_search_view"/>
             <field name="arch" type="xml">
-                <field name="name" position="replace">
-                   <field name="name" string="Product" filter_domain="['|',('default_code','ilike',self),('name','ilike',self)]"/>
-                </field>
                 <field name="product_variant_ids" position="replace">
                     <field name="attribute_value_ids"/>
                 </field>