when i make a scan to barcode is not equal to the barcode in the product
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilità
- Magazzino
- PoS
- Project
- MRP
La domanda è stata contrassegnata
1
Rispondi
2256
Visualizzazioni
Hi,
If your product's barcode is generated automatically, check to see that it is functioning properly.
Then check the barcode of the corresponding product while scanning the barcode.
Let's say there is a field for scanning the barcode when the product moves, in that case you can use the following code:
scan_barcode = fields.Char(
string="scan product",
help="scan barcode of product here")
@api.onchange('scan_barcode')
def onchange_scan_barcode(self):
"""checking barcode with the corresponding product"""
order_product = self.env['product.product'].search(
[('barcode', '=', self.scan_barcode)])
lst=[]
if order_product:
for rec in self.move_ids:
lst.append(rec.product_id.id)
for rec in self.move_ids:
if order_product.id in lst:
if order_product.id == rec.product_id.id:
po= self.env['purchase.order'].search([('name','=',self.origin)])
for product in po.order_line:
if product.product_id.id == rec.product_id.id:
rec.scanned_count += 1
rec.product_uom_qty += 1
rec.product_barcode=self.scan_barcode
self.scan_barcode = 0
break
else:
vals = {
'name': order_product.name,
'product_id': order_product.id,
'reference': rec.reference,
'product_uom_qty': 1,
'product_barcode':self.scan_barcode,
'product_uom': order_product.uom_id.id,
'picking_type_id': rec.picking_type_id.id,
'origin': rec.origin,
'scanned_count':1,
'location_id': rec.location_id,
'location_dest_id':rec.location_dest_id
}
self.write({
'move_ids': [(0, 0, vals),]
})
lst.append(order_product.id)
break
else:
raise ValidationError(_('Sorry there is no product with such barcode'))
self.scan_barcode = 0
Regards
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
RegistratiPost correlati | Risposte | Visualizzazioni | Attività | |
---|---|---|---|---|
|
0
nov 24
|
1580 | ||
|
2
lug 23
|
2224 | ||
|
0
lug 23
|
1650 | ||
|
0
apr 25
|
1301 | ||
|
0
dic 24
|
3105 |