class ProductAutoBarcode(models.Model):
_inherit = 'product.product'
@api.model
def create(self, vals):
res = super(ProductAutoBarcode, self).create(vals)
ean = generate_ean(str(res.id))
res.barcode = ean
return res
note
on print its give me value on every time when product created --------------------->ean
1 - this code is not working on first time when i create product with variants
when it work.
when i create product without variants and save button press then its giving me value else empty