feat: bigger product size
This commit is contained in:
@@ -4,4 +4,6 @@ from models import Product
|
|||||||
|
|
||||||
class SizeAttributeGetter(BaseAttributeGetter):
|
class SizeAttributeGetter(BaseAttributeGetter):
|
||||||
def get_value(self, product: Product):
|
def get_value(self, product: Product):
|
||||||
return product.size
|
if not product.size:
|
||||||
|
return None
|
||||||
|
return f'<font size="8" name="Helvetica-Bold"><b>{product.size}</b></font>'
|
||||||
|
|||||||
@@ -21,11 +21,15 @@ class DefaultBarcodeGenerator(BaseBarcodeGenerator):
|
|||||||
if not attribute_getter:
|
if not attribute_getter:
|
||||||
continue
|
continue
|
||||||
value = attribute_getter.get_value(barcode_data["product"])
|
value = attribute_getter.get_value(barcode_data["product"])
|
||||||
|
|
||||||
if not value or not value.strip():
|
if not value or not value.strip():
|
||||||
continue
|
continue
|
||||||
attributes[attribute.name] = value
|
attributes[attribute.name] = value
|
||||||
for additional_attribute in barcode_data["template"].additional_attributes:
|
for additional_attribute in barcode_data["template"].additional_attributes:
|
||||||
attributes[additional_attribute.name] = additional_attribute.value
|
value = additional_attribute.value
|
||||||
|
if not value:
|
||||||
|
continue
|
||||||
|
attributes[additional_attribute.name] = value
|
||||||
barcode_text = '<br/>'.join([f'{key}: {value}' for key, value in attributes.items()])
|
barcode_text = '<br/>'.join([f'{key}: {value}' for key, value in attributes.items()])
|
||||||
|
|
||||||
pdf_barcodes_gen_data.append(
|
pdf_barcodes_gen_data.append(
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class PDFGenerator:
|
|||||||
leading=7,
|
leading=7,
|
||||||
spaceAfter=2,
|
spaceAfter=2,
|
||||||
leftIndent=2,
|
leftIndent=2,
|
||||||
rightIndent=2
|
rightIndent=2,
|
||||||
)
|
)
|
||||||
|
|
||||||
def generate_small_text(self, barcode_value, text, num_duplicates=1):
|
def generate_small_text(self, barcode_value, text, num_duplicates=1):
|
||||||
|
|||||||
Reference in New Issue
Block a user