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 #### Version 17.0.1.0.2
##### BUG FIX ##### BUG FIX
- Added an alert and fix issue of multiple barcode - 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. the associated multi-barcode product template.
""" """
res = super(ProductProduct, self).write(vals) res = super(ProductProduct, self).write(vals)
self.product_multi_barcodes_ids.update({ if 'product_multi_barcodes_ids' in vals:
'template_multi_id': self.product_tmpl_id.id self.product_multi_barcodes_ids.update({
}) 'template_multi_id': self.product_tmpl_id.id
})
return res 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. and update the associated multi-barcode product.
""" """
res = super(ProductTemplate, self).create(vals) res = super(ProductTemplate, self).create(vals)
res.template_multi_barcodes_ids.update({ if res.product_variant_count == 1:
'product_multi_id': res.product_variant_id.id res.template_multi_barcodes_ids.update({
}) 'product_multi_id': res.product_variant_id.id
})
return res return res
def write(self, vals): def write(self, vals):
@ -50,8 +51,9 @@ class ProductTemplate(models.Model):
update the associated multi-barcode product. update the associated multi-barcode product.
""" """
res = super(ProductTemplate, self).write(vals) res = super(ProductTemplate, self).write(vals)
if self.template_multi_barcodes_ids: for rec in self:
self.template_multi_barcodes_ids.update({ if rec.product_variant_count == 1 and rec.template_multi_barcodes_ids:
'product_multi_id': self.product_variant_id.id rec.template_multi_barcodes_ids.update({
}) 'product_multi_id': rec.product_variant_id.id
})
return res return res

Loading…
Cancel
Save