Fix: string ip_addres

This commit is contained in:
sinergia 2024-10-20 13:43:00 -05:00
parent 6157328b80
commit 6d97f92fcd

34
sale.py
View File

@ -197,23 +197,17 @@ class Sale(metaclass=PoolMeta):
data["zone"] = report.zone.name if report.zone else ""
data["table"] = report.table.name if report.table else ""
data["lines"] = [{
'type': line.type,
"product": line.product.name if line.type != 'title' else None,
"description": line.description if line.type != 'title' else None,
"quantity": line.quantity if line.type != 'title' else None,
"uom": line.unit.name if line.type != 'title' else None}
"type": line.type,
"product": line.product.name if line.type != "title" else None,
"description": line.description if line.type != "title" else None,
"quantity": line.quantity if line.type != "title" else None,
"uom": line.unit.name if line.type != "title" else None}
for line in report.lines if not line.impreso]
data["deleted_lines"] = [{
<<<<<<< HEAD
"product": line.product.name,
"quantity": str(-1 * line.quantity),
"unit": line.unit.symbol,
} for line in report.delete_lines if not line.printed]
=======
"product": line.product.name if line.type != 'title' else None,
"quantity": line.quantity if line.type != 'title' else None,
} for line in report.delete_lines if not line.impreso]
>>>>>>> 77d626374f847b8e54b81cc06f76b545e4014b29
"product": line.product.name,
"quantity": str(-1 * line.quantity),
"unit": line.unit.symbol
} for line in report.delete_lines if not line.printed]
return data
@ -238,11 +232,7 @@ class Sale(metaclass=PoolMeta):
line.save()
for line in record.delete_lines:
<<<<<<< HEAD
line.printed = True
=======
line.impreso = True
>>>>>>> 77d626374f847b8e54b81cc06f76b545e4014b29
line.save()
record.save()
@ -321,7 +311,7 @@ class Sale(metaclass=PoolMeta):
if printer.type_ == 'network':
content["printer_type"] = "Network"
content["ip_printer"] = str(printer.ip_address),
content["ip_printer"] = str(printer.ip_address)
else:
if printer.type_ == 'usb':
content["printer_type"] = "USB"
@ -333,8 +323,8 @@ class Sale(metaclass=PoolMeta):
cls.impreso([record])
requests.post(
url, data=json.dumps(content),
headers=headers, timeout=5)
url, data=str(json.dumps(content)),
headers=headers)
@classmethod
@ModelView.button