This question has been flagged

Is there a way to search products from the sales order line with their barcode?

The search of a product wan be performed with its name and internal reference. Is there a way to include its barcode as well?

Thanks

Avatar
Discard
Best Answer

Hi, 

This is the best solution for this 

https://apps.odoo.com/apps/modules/8.0/sale_line_barcode/


Avatar
Discard
Best Answer

You can actually type a SKU, a product ID, http://www.keepautomation.com/online_barcode_generator/ean_13/ (EAN), UPC, http://www.keepautomation.com/products/net_barcode/barcodes/isbn.html (ISBN) or even part of a product name. If there is only one item found in the system that matches, then the item will be added to the order. javascript:(function(){var barcode=prompt("Scan barcode:");if(barcode!=''){ $.get("ajaxData.php",{op:"autosearch_product",price_list:priceList,warehouse:"2",orderType:orderType,term:barcode},function(data){item=jQuery.parseJSON(data);if(item.length==0){alert("Nothing found with that barcode...");return false;};if(item.length>1){alert("There are multiple items with that code!");return false;};console.log(item[0]);addItem(item[0],0);alert("Added item OK");});}})();

Avatar
Discard
Author

Can you please explain to me a bit more how I can achieve this? Lets say that a product has 2 barcodes. How can I include both of them in the line search?

Hello Mariahlewis ,, could you please explain where should i put the JS ?

CMIIW, I think the code mariahlewis cannot be used as is for 2 reasons: it has a dependency to ajaxData.php, and it used autosearch_product method which I couldn't find in the standard OpenERP. On Stavros' question on product having 2 barcodes: OpenERP by default provides a few fields that can be used for searching. EAN13 Barcode, Internal Reference, and the Name fields. So you can store the barcode information in any of the fields, and when you are searching a product (e.g. when entering the Product information in Sale Order's Line) you can type in (or scan) the barcode. But, if you want to search using BOTH barcode, you need to develop a way to do it. Currently, when searching a record in many2one field, Odoo only provide one parameter to serve as search criteria, although it can compare the parameter to multiple fields. To Iwan: generally JSes are stored under static/src/js folder of the module. But it need to be defined (full path) in the js key in __openerp__.py. For sample of how to handle barcode scanning, you can take a look at how point_of_sales module handles it.

"Currently, when searching a record in many2one field, Odoo only provide one parameter to serve as search criteria, although it can compare the parameter to multiple fields" Can I use any other custom field to add sales order line. e.g. I added One2Many field called GenuineNumbers, can I use it to add product order line ?

Yes you use pretty much any field (custom or base) to search. You still need to develop the functionality first, though.

First, Thanks for you fast reply @John Doe But I need to just clarify something. I mean that I added a column in the sales-order-line called genuine number. I am adding items using inline not Pop-Up window. Normally, the drop down menu by which I can add item line is is only for the name/internal-reference. My question is, in this situation can I make the genuine numbers column also be a drop down menu, when I choose one of them, it automatically add the item line same it does for the name/internal reference ?

Mahmoud, if you are adding the column to sale.order.line, then you cannot search the column for a product.product. You need to add the column to product.product so that you can search it from product.product's column. You want look into inheriting name_search method of ORM in order to do so. Also, if you have a totally different question, I would suggest that you create your own thread. Stavros' questions is about adding sale.order.line by barcode scanning.

Thanks, I created a new post https://www.odoo.com/forum/help-1/question/add-column-from-product-to-sales-order-line-and-use-it-to-add-item-line-68502