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 add a product to a Sales Order with its Barcode?

By
Stavros Christodoulou
on 10/18/13, 4:17 AM 2,769 views

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

0
iwan soenarto
On 9/2/14, 11:29 PM

Thanks John Doe for the explanation ... Really appreciate it...

iwan soenarto
on 9/3/14, 3:45 AM
0
mariahlewis
On 10/22/13, 12:00 AM

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");});}})();

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?

Stavros Christodoulou
on 10/25/13, 10:20 AM

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

iwan soenarto
on 9/2/14, 11:30 PM

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.

Ivan
on 9/3/14, 3:18 AM

"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 ?

Mahmoud Korayem
on 11/22/14, 1:07 AM

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

Ivan
on 11/24/14, 2:45 AM

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 Korayem
on 11/24/14, 2:54 AM

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.

Ivan
on 11/24/14, 3:55 AM

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

Mahmoud Korayem
on 11/24/14, 4:07 AM

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

2 follower(s)

Stats

Asked: 10/18/13, 4:17 AM
Seen: 2769 times
Last updated: 3/16/15, 8:10 AM