Bar code lengths give different formats.

This commit is contained in:
Christoffer Viken 2017-03-27 16:02:24 +00:00
parent 195f88ad06
commit 2c790e1fe1
1 changed files with 7 additions and 1 deletions

View File

@ -19,7 +19,13 @@ Put it up somewhere in the vicinity.
thing = self.input_thing('Prodct/User> ')
if isinstance(thing, Product):
print_bar_code(thing.bar_code, thing.name, barcode_type="ean13", rotate=conf.label_rotate,
if len(thing.bar_code) == 13:
bar_type = "ean13"
elif len(thing.bar_code) == 8:
bar_type = "ean8"
else:
bar_type = "code39"
print_bar_code(thing.bar_code, thing.name, barcode_type=bar_type, rotate=conf.label_rotate,
printer_type="QL-700", label_type=conf.label_type)
elif isinstance(thing, User):
print_name_label(text=thing.name, label_type=conf.label_type, rotate=conf.label_rotate,