diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py
index fc6e087fabf..18f37db8806 100644
--- a/addons/point_of_sale/pos.py
+++ b/addons/point_of_sale/pos.py
@@ -24,6 +24,7 @@ import time
import netsvc
from osv import fields, osv
from mx import DateTime
+from tools.translate import _
class pos_config_journal(osv.osv):
@@ -811,6 +812,52 @@ class pos_order_line(osv.osv):
return False
return super(pos_order_line, self).write(cr, user, ids, values, context)
+ def _scan_product(self, cr, uid, ean, qty, order):
+ # search pricelist_id
+ pricelist_id = self.pool.get('pos.order').read(cr, uid, [order], ['pricelist_id'] )
+ if not pricelist_id:
+ return False
+
+ new_line = True
+
+ product_id = self.pool.get('product.product').search(cr, uid, [('ean13','=', ean)])
+ if not product_id:
+ return false
+
+ # search price product
+ product = self.pool.get('product.product').read(cr, uid, product_id)
+ product_name = product[0]['name']
+ price = self.price_by_product(cr, uid, 0, pricelist_id[0]['pricelist_id'][0], product_id[0], 1)
+
+ order_line_ids = self.search(cr, uid, [('name','=',product_name),('order_id','=',order)])
+ if order_line_ids:
+ new_line = False
+ order_line_id = order_line_ids[0]
+ qty += self.read(cr, uid, order_line_ids[0], ['qty'])['qty']
+
+ if new_line:
+ vals = {'product_id': product_id[0],
+ 'price_unit': price,
+ 'qty': qty,
+ 'name': product_name,
+ 'order_id': order,
+ }
+ line_id = self.create(cr, uid, vals)
+ if not line_id:
+ raise wizard.except_wizard(_('Error'), _('Create line failed !'))
+ else:
+ vals = {
+ 'qty': qty,
+ 'price_unit': price
+ }
+ line_id = self.write(cr, uid, order_line_id, vals)
+ if not line_id:
+ raise wizard.except_wizard(_('Error'), _('Modify line failed !'))
+ line_id = order_line_id
+
+ price_line = float(qty)*float(price)
+ return {'name': product_name, 'product_id': product_id[0], 'price': price, 'price_line': price_line ,'qty': qty }
+
pos_order_line()
diff --git a/addons/point_of_sale/pos_wizard.xml b/addons/point_of_sale/pos_wizard.xml
index 67ff7069ae0..afef00eb17f 100644
--- a/addons/point_of_sale/pos_wizard.xml
+++ b/addons/point_of_sale/pos_wizard.xml
@@ -26,5 +26,8 @@
+
+
diff --git a/addons/point_of_sale/wizard/__init__.py b/addons/point_of_sale/wizard/__init__.py
index 466b2ad22b3..858ea4a474a 100644
--- a/addons/point_of_sale/wizard/__init__.py
+++ b/addons/point_of_sale/wizard/__init__.py
@@ -27,5 +27,6 @@ import wizard_add_product
import wizard_confirm
import wizard_discount
import wizard_get_sale
+import wizard_scan_product
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/wizard/wizard_scan_product.py b/addons/point_of_sale/wizard/wizard_scan_product.py
new file mode 100644
index 00000000000..9320b4ffb6f
--- /dev/null
+++ b/addons/point_of_sale/wizard/wizard_scan_product.py
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved
+# Copyright (c) 2008 Sylëam Info Services. (http://www.syleam.fr) All Rights Reserved.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import pooler
+import wizard
+from osv import osv
+
+form_gencod = """
+
+"""
+
+fields_gencod = {
+ 'gencod': {'string': 'Gencod',
+ 'type': 'char',
+ 'size': 13,
+ 'required': True}
+}
+
+
+def _scan(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ result = pool.get('pos.order.line')._scan_product(cr, uid, data['form']['gencod'], 1, data['id'])
+ return {'gencod': False}
+
+def _pre_init(self, cr, uid, data, context):
+ return {'gencod': False}
+
+class pos_scan_product(wizard.interface):
+ states = {
+ 'init' : {'actions' : [_pre_init],
+ 'result' : {
+ 'type': 'form',
+ 'arch': form_gencod,
+ 'fields': fields_gencod,
+ 'state': [('end','Cancel','gtk-cancel'),
+ ('add', 'Add', 'gtk-ok', True)],
+ }
+ },
+ 'add' : {'actions' : [_scan],
+ 'result' : {
+ 'type': 'state',
+ 'state': 'init',
+ }
+ }
+ }
+
+pos_scan_product('pos.scan_product')
+