This commit is contained in:
2017-04-15 18:47:28 +00:00
parent 4669737fe3
commit 1c8f03695a
9 changed files with 70 additions and 561 deletions

View File

@@ -1,3 +1,5 @@
import re
from db import Product, User
from printer_helpers import print_bar_code, print_name_label
from text_interface.helpermenus import Menu
@@ -19,9 +21,9 @@ Put it up somewhere in the vicinity.
thing = self.input_thing('Prodct/User> ')
if isinstance(thing, Product):
if len(thing.bar_code) == 13:
if re.match(r"^[0-9]{13}$", thing.bar_code):
bar_type = "ean13"
elif len(thing.bar_code) == 8:
elif re.match(r"^[0-9]{8}$", thing.bar_code):
bar_type = "ean8"
else:
bar_type = "code39"