summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-12-10 11:25:10 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-12-10 11:25:10 +0700
commitcc9abe07512a6e317dc82f6a4be626c55f298379 (patch)
tree2d1766b06cdbd0656dc2696d4602363805f96d86
parent9dbae80871e94f439ea1b6c3cf6a13cab9221532 (diff)
fix bug
-rwxr-xr-xindoteknik_custom/models/product_template.py38
-rwxr-xr-xindoteknik_custom/views/product_template.xml2
2 files changed, 20 insertions, 20 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index ebf81811..b38f9155 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -65,25 +65,25 @@ class ProductTemplate(models.Model):
short_spesification = fields.Char(string='Short Spesification')
merchandise_ok = fields.Boolean(string='Product Promotion')
print_barcode = fields.Boolean(string='Print Barcode', default="True")
- qr_code = fields.Binary("QR Code", compute='_compute_qr_code')
-
- def _compute_qr_code(self):
- for rec in self.product_variant_ids:
- qr = qrcode.QRCode(
- version=1,
- error_correction=qrcode.constants.ERROR_CORRECT_L,
- box_size=5,
- border=4,
- )
- qr.add_data(rec.display_name)
- qr.make(fit=True)
- img = qr.make_image(fill_color="black", back_color="white")
-
- buffer = BytesIO()
- img.save(buffer, format="PNG")
- qr_code_img = base64.b64encode(buffer.getvalue()).decode()
-
- rec.qr_code = qr_code_img
+ # qr_code = fields.Binary("QR Code", compute='_compute_qr_code')
+
+ # def _compute_qr_code(self):
+ # for rec in self.product_variant_ids:
+ # qr = qrcode.QRCode(
+ # version=1,
+ # error_correction=qrcode.constants.ERROR_CORRECT_L,
+ # box_size=5,
+ # border=4,
+ # )
+ # qr.add_data(rec.display_name)
+ # qr.make(fit=True)
+ # img = qr.make_image(fill_color="black", back_color="white")
+
+ # buffer = BytesIO()
+ # img.save(buffer, format="PNG")
+ # qr_code_img = base64.b64encode(buffer.getvalue()).decode()
+
+ # rec.qr_code = qr_code_img
@api.constrains('name', 'internal_reference', 'x_manufacture')
def required_public_categ_ids(self):
diff --git a/indoteknik_custom/views/product_template.xml b/indoteknik_custom/views/product_template.xml
index 93ea11a2..af21984a 100755
--- a/indoteknik_custom/views/product_template.xml
+++ b/indoteknik_custom/views/product_template.xml
@@ -20,7 +20,7 @@
<field name="unpublished" />
<field name="desc_update_solr" readonly="1" />
<field name="last_update_solr" readonly="1" />
- <field name="qr_code" widget="image" invisible="1"/>
+ <!-- <field name="qr_code" widget="image" invisible="1"/> -->
</field>
<field name="public_categ_ids" position="attributes">
<attribute name="required">0</attribute>