diff options
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 00e756c9..9007dd71 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -404,12 +404,17 @@ class ProductProduct(models.Model): qr_code_variant = fields.Binary("QR Code Variant", compute='_compute_qr_code_variant') def _compute_qr_code_variant(self): - for rec in self.product_variant_ids: + for rec in self: + # Skip inactive variants + if not rec.active: + rec.qr_code_variant = False # Clear the QR Code for archived variants + continue + qr = qrcode.QRCode( - version=1, - error_correction=qrcode.constants.ERROR_CORRECT_L, - box_size=5, - border=4, + version=1, + error_correction=qrcode.constants.ERROR_CORRECT_L, + box_size=5, + border=4, ) qr.add_data(rec.display_name) qr.make(fit=True) |
