From 6d97f92fcd3bcbe0947cb78a3aaa351a7f847879 Mon Sep 17 00:00:00 2001 From: sinergia Date: Sun, 20 Oct 2024 13:43:00 -0500 Subject: [PATCH] Fix: string ip_addres --- sale.py | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/sale.py b/sale.py index b3ab2e2..1261dfb 100644 --- a/sale.py +++ b/sale.py @@ -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