diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-12-19 10:33:53 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-12-19 10:33:53 +0700 |
| commit | d35c2dce88a87bc05d30c4935d51d7d58aa5d37d (patch) | |
| tree | e415d707b311ba1e17cf628145b282be8928b272 | |
| parent | 9b305f2f64e61d3197be53e69f7dfc8bbacc224c (diff) | |
fix qr code variant
| -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) |
