You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

17 lines
598 B

from odoo import api, models, fields
class PurchaseOrderLines(models.Model):
_inherit = "purchase.order.line"
barcode_scan = fields.Char(string='Product Barcode', help="Here you can provide the barcode for the product")
@api.onchange('barcode_scan')
def _onchange_barcode_scan(self):
print('purchase')
product_rec = self.env['product.product']
if self.barcode_scan:
product = product_rec.search([('barcode', '=', self.barcode_scan)])
self.product_id = product.id
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: