summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/product_template.py
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-01-07 16:02:47 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-01-07 16:02:47 +0700
commit61c9291070da3ef7f81774290db1923789792210 (patch)
treec010ebacb209dfb57fb5fe1d23e986c4b051cac1 /indoteknik_custom/models/product_template.py
parentc971e71a19426de6c210100e2e110319df81aafa (diff)
parent1ec4b411c91851202a6058b531257f45fdd76457 (diff)
Merge branch 'production' into iman/pengajuan-tempo
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
-rwxr-xr-xindoteknik_custom/models/product_template.py15
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)