Browse Source

May 19: [FIX] Bug fixed 'multi_barcodes_pos'

17.0
Cybrosys Technologies 5 days ago
parent
commit
96216c3d13
  1. 5
      multi_barcodes_pos/doc/RELEASE_NOTES.md
  2. 7
      multi_barcodes_pos/models/product_product.py
  3. 16
      multi_barcodes_pos/models/product_template.py

5
multi_barcodes_pos/doc/RELEASE_NOTES.md

@ -14,3 +14,8 @@
#### Version 17.0.1.0.2
##### BUG FIX
- Added an alert and fix issue of multiple barcode
#### 19.05.2025
#### Version 17.0.1.0.3
##### BUG FIX
- Fixed a bug where updating the product template caused the barcodes of all variants to be assigned to the first variant, resulting in the removal of barcodes from the other variants.

7
multi_barcodes_pos/models/product_product.py

@ -50,7 +50,8 @@ class ProductProduct(models.Model):
the associated multi-barcode product template.
"""
res = super(ProductProduct, self).write(vals)
self.product_multi_barcodes_ids.update({
'template_multi_id': self.product_tmpl_id.id
})
if 'product_multi_barcodes_ids' in vals:
self.product_multi_barcodes_ids.update({
'template_multi_id': self.product_tmpl_id.id
})
return res

16
multi_barcodes_pos/models/product_template.py

@ -39,9 +39,10 @@ class ProductTemplate(models.Model):
and update the associated multi-barcode product.
"""
res = super(ProductTemplate, self).create(vals)
res.template_multi_barcodes_ids.update({
'product_multi_id': res.product_variant_id.id
})
if res.product_variant_count == 1:
res.template_multi_barcodes_ids.update({
'product_multi_id': res.product_variant_id.id
})
return res
def write(self, vals):
@ -50,8 +51,9 @@ class ProductTemplate(models.Model):
update the associated multi-barcode product.
"""
res = super(ProductTemplate, self).write(vals)
if self.template_multi_barcodes_ids:
self.template_multi_barcodes_ids.update({
'product_multi_id': self.product_variant_id.id
})
for rec in self:
if rec.product_variant_count == 1 and rec.template_multi_barcodes_ids:
rec.template_multi_barcodes_ids.update({
'product_multi_id': rec.product_variant_id.id
})
return res

Loading…
Cancel
Save