From cc9abe07512a6e317dc82f6a4be626c55f298379 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 10 Dec 2024 11:25:10 +0700 Subject: fix bug --- indoteknik_custom/models/product_template.py | 38 ++++++++++++++-------------- indoteknik_custom/views/product_template.xml | 2 +- 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 @@ - + 0 -- cgit v1.2.3