Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4625 มุมมอง

class ProductAutoBarcode(models.Model): 

 _inherit = 'product.product'
@api.model def create(self, vals): 

 numbers = self.env['ir.sequence'].next_by_code('product.barcode') or _('New') 

#vals.update({'barcode':numbers}) #i try same result

#vals['barcode'] = numbers #i try same result

 res = super(ProductAutoBarcode, self).create(vals) 

 res.write({'barcode': numbers}) 

 return res

Problem is 

Case 1

when i create product with single variants like Size = Small its not generate barcode seqence even show in print command

barcode filed = empty 

Case 2

when i create product with multi variants like Size = Small,Medium,Large barcode is generated at that time its skip first varients Small 

product size small empty

product size medium 0xxxxxxxxxx ok

product size Large 0xxxxxxxxxx ok


Case 3

In short its leave always first barcode number for first product variants 


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
เม.ย. 24
1935
5
ธ.ค. 19
3732
0
ส.ค. 19
4
5
ส.ค. 19
2803
1
ก.พ. 19
6971