mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[IMP] Add QRcode in printer_zpl2 module
This commit is contained in:
committed by
Lois Rilo
parent
9ddd695de1
commit
a2d632337c
@@ -158,6 +158,10 @@ class PrintingLabelZpl2(models.Model):
|
||||
label_offset_x=component_offset_x,
|
||||
label_offset_y=component_offset_y)
|
||||
else:
|
||||
if component.component_type == zpl2.BARCODE_QR_CODE:
|
||||
# Adding Control Arguments to QRCode data Label
|
||||
data = 'MM,A{}'.format(data)
|
||||
|
||||
barcode_arguments = dict([
|
||||
(field_name, component[field_name])
|
||||
for field_name in [
|
||||
@@ -172,6 +176,10 @@ class PrintingLabelZpl2(models.Model):
|
||||
zpl2.ARG_TRUNCATE,
|
||||
zpl2.ARG_MODULE_WIDTH,
|
||||
zpl2.ARG_BAR_WIDTH_RATIO,
|
||||
zpl2.ARG_MODEL,
|
||||
zpl2.ARG_MAGNIFICATION_FACTOR,
|
||||
zpl2.ARG_ERROR_CORRECTION,
|
||||
zpl2.ARG_MASK_VALUE,
|
||||
]
|
||||
])
|
||||
label_data.barcode_data(
|
||||
|
||||
@@ -44,6 +44,7 @@ class PrintingLabelZpl2Component(models.Model):
|
||||
(zpl2.BARCODE_UPC_E, 'UPC-E'),
|
||||
(zpl2.BARCODE_CODE_128, 'Code 128'),
|
||||
(zpl2.BARCODE_EAN_13, 'EAN-13'),
|
||||
(zpl2.BARCODE_QR_CODE, 'QR Code'),
|
||||
('sublabel', 'Sublabel'),
|
||||
], string='Type', required=True, default='text', oldname='type',
|
||||
help='Type of content, simple text or barcode.')
|
||||
@@ -98,6 +99,23 @@ class PrintingLabelZpl2Component(models.Model):
|
||||
rows_count = fields.Integer(help='Number of rows to encode.')
|
||||
truncate = fields.Boolean(
|
||||
help='Check if you want to truncate the barcode.')
|
||||
model = fields.Selection(
|
||||
selection=[
|
||||
(zpl2.MODEL_ORIGINAL, 'Original'),
|
||||
(zpl2.MODEL_ENHANCED, 'Enhanced'),
|
||||
], default=zpl2.MODEL_ENHANCED,
|
||||
help='Barcode model, used by some barcode types like QR Code.')
|
||||
magnification_factor = fields.Integer(
|
||||
default=1, help='Magnification Factor, from 1 to 10.')
|
||||
error_correction = fields.Selection(
|
||||
selection=[
|
||||
(zpl2.ERROR_CORRECTION_ULTRA_HIGH, 'Ultra-high Reliability Level'),
|
||||
(zpl2.ERROR_CORRECTION_HIGH, 'High Reliability Level'),
|
||||
(zpl2.ERROR_CORRECTION_STANDARD, 'Standard Level'),
|
||||
(zpl2.ERROR_CORRECTION_HIGH_DENSITY, 'High Density Level'),
|
||||
], required=True, default=zpl2.ERROR_CORRECTION_HIGH,
|
||||
help='Error correction for some barcode types like QR Code.')
|
||||
mask_value = fields.Integer(default=7, help='Mask Value, from 0 to 7.')
|
||||
data = fields.Char(
|
||||
size=256, default='""', required=True,
|
||||
help='Data to print on this component. Resource values can be '
|
||||
|
||||
Reference in New Issue
Block a user