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

How can i search a product using name or barcode from search bar of product?

By
samba
on 8/25/14, 1:27 AM 2,361 views

From the search bar of product now we can search using name of product, but my need is have to search with name or barcode. we can use advanced search barcode, to search a product using barcode. But i want to use only serch bar not advanced search. As per my knowledge i have to change "name_search" in produc.product. Please provide me that function code. correct me if i am wrong.

Hi Samba, If you want practical ex. then I can give you or give me your code I will correct it.

Emipro Technologies Pvt. Ltd.
on 8/25/14, 7:24 AM

Ex given by Shashank is the first way as I have explain.

Emipro Technologies Pvt. Ltd.
on 8/25/14, 8:36 AM

from openerp.osv import fields, osv import os.path import fnmatch from tools.translate import _ class product_extension(osv.osv): _inherit = "product.product" _columns = { 'ean13': fields.char('Barcode', size=256, help="International Article Number used for product identification."), } def _check_ean_key(self, cr, uid, ids, context=None): return True _constraints = [(_check_ean_key, 'You provided an invalid "EAN13 Barcode" reference. You may use the "Internal Reference" field instead.', ['ean13'])] def name_search(self, cr, uid, name='', args=None, operator='ilike', context=None): if not args: args = [] if name: args += ['|',('name',operator,name),('ean13',operator,name)] dept_ids = self.search(cr, uid, args, context=context) else: dept_ids = self.search(cr, uid, args, context=context) return self.name_get(cr, uid, dept_ids, context=context)

samba
on 8/25/14, 11:07 AM
1

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
Tiny ERP Pvt Ltd
http://www.odoo.com
5975
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.

 

Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 

 

We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :

 

  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 8/25/14, 6:05 AM

Hi Samba,

There is two way to achive your objective.

1) Keep product name and add barcode into search bar.

For this you have to just add "ean13" field into search view by inheriting product search view.

2) Replace product name with Barcode into search bar.

For this you have to just replace "name" field with "ean13" field into search view by inheriting product search view.

1
shashank verma
On 8/25/14, 8:30 AM

Hello Samba,

U need to add your field name inside search view in .xml file.Lets consider an example:

        <record id="view_my_product_filter" model="ir.ui.view">
            <field name="name">my.object.search</field>
            <field name="model">my.object</field>
            <field name="arch" type="xml">
                <search string="Search Me">
                
                    <field name="name" string="Product Name" />
                    <field name="my_barcode" string="Barcode"/>
               </search>
            </field>
        </record>    

        
        

So when you type smething on search bar ,a drop down  list will appear. Select from the drop down list(product name,barcode) and hit enter.        

Visit below  link for better understanding

http://postimg.org/image/w3qqj5wh1/

0

If you give in Internal reference to your product like Food_bread_1KG you can find it when you search in the search bar... you can type bread or 1KG or food and you will find it. 

but for barcode i dont know :)

0
ahmad
On 8/25/14, 5:16 AM

you have to use advanced search, choose EAN13 barcode. then you can put the barcode.

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

3 follower(s)

Stats

Asked: 8/25/14, 1:27 AM
Seen: 2361 times
Last updated: 3/16/15, 8:10 AM