feat: Se añade content para impresora pos de Tipo Usb
This commit is contained in:
parent
d8a6752bf7
commit
522a502268
43
sale.py
43
sale.py
@ -252,13 +252,22 @@ class Sale(metaclass=PoolMeta):
|
||||
user_name = context['employee.rec_name']
|
||||
else:
|
||||
user_name = ""
|
||||
|
||||
content = {"content": str(json.dumps(bill)),
|
||||
"ip_printer": str(printer.ip_address),
|
||||
"user_name": user_name}
|
||||
|
||||
if printer.type_ == 'network':
|
||||
content["ip_printer"] = str(printer.ip_address),
|
||||
else:
|
||||
if printer.type_ == 'usb':
|
||||
content["idVendor"] = str(printer.idVendor)
|
||||
content["idProduct"] = str(printer.idProduct)
|
||||
|
||||
headers = {"accept": 'application/json',
|
||||
'Content-Type': 'application/json'}
|
||||
|
||||
response = requests.post(url, data=json.dumps(content), headers=headers)
|
||||
response = requests.post(
|
||||
url, data=json.dumps(content), headers=headers)
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@ -275,15 +284,24 @@ class Sale(metaclass=PoolMeta):
|
||||
|
||||
printer = printers[0]
|
||||
|
||||
|
||||
url = f"http://{printer.api.ip_address}/order_kitchen"
|
||||
customer_order = cls.report_customer_order(records)
|
||||
if 'employee.rec_name' in context.keys():
|
||||
user_name = context['employee.rec_name']
|
||||
else:
|
||||
user_name = ""
|
||||
content = {"content": str(json.dumps(customer_order)),
|
||||
"ip_printer": str(printer.ip_address),
|
||||
|
||||
content = {"content": str(json.dumps(bill)),
|
||||
"user_name": user_name}
|
||||
|
||||
if printer.type_ == 'network':
|
||||
content["ip_printer"] = str(printer.ip_address),
|
||||
else:
|
||||
if printer.type_ == 'usb':
|
||||
content["idVendor"] = str(printer.idVendor)
|
||||
content["idProduct"] = str(printer.idProduct)
|
||||
|
||||
headers = {"accept": 'application/json',
|
||||
'Content-Type': 'application/json'}
|
||||
cls.impreso([record])
|
||||
@ -308,14 +326,25 @@ class Sale(metaclass=PoolMeta):
|
||||
url = f"http://{printer.api.ip_address}/order_bar"
|
||||
customer_order = cls.report_customer_order(records)
|
||||
cls.impreso([record])
|
||||
|
||||
if 'employee.rec_name' in context.keys():
|
||||
user_name = context['employee.rec_name']
|
||||
else:
|
||||
user_name = ""
|
||||
content = {"content": str(json.dumps(customer_order)),
|
||||
"ip_printer": str(printer.ip_address),
|
||||
|
||||
content = {
|
||||
"content": str(json.dumps(bill)),
|
||||
"user_name": user_name}
|
||||
headers = {"accept": 'application/json',
|
||||
|
||||
if printer.type_ == 'network':
|
||||
content["ip_printer"] = str(printer.ip_address),
|
||||
else:
|
||||
if printer.type_ == 'usb':
|
||||
content["idVendor"] = str(printer.idVendor)
|
||||
content["idProduct"] = str(printer.idProduct)
|
||||
|
||||
headers = {
|
||||
"accept": 'application/json',
|
||||
'Content-Type': 'application/json'}
|
||||
response = requests.post(url, data=json.dumps(content),
|
||||
headers=headers)
|
||||
|
@ -6,7 +6,7 @@ depends:
|
||||
product
|
||||
sale
|
||||
sale_supply_production
|
||||
#sale_printer
|
||||
sale_printer
|
||||
production
|
||||
account_invoice
|
||||
sale_shop
|
||||
|
Loading…
Reference in New Issue
Block a user