I have the following problem, I have the following code which is responsible for sending the data to the imprimir_ticket
module:
from es import imprimir_ticket
def productos(self):
lista_01 = []
pago = self.Cantidad.text()
if lista1 == []:
QMessageBox.critical(None,"Error \n\n","Ningun elemento en la lista de ventas \t",QMessageBox.Ok)
elif pago.isdigit() == False:
QMessageBox.critical(None,"Error \n\n","El tipo de cambio no es valido \t",QMessageBox.Ok)
else:
for i in lista1:
self.producto_especifico_id(i,sucursal)
if len(i) == 4:
ref =db.reference('/Productos_Bar')
r11 = ref.get()
for key in r11.items():
res = key[1]['id']
if res == i:
new_ref = key[0]
ref_s = db.reference('/Productos_Bar/'+str(new_ref))
r12 = ref_s.get()
for key in r12.items():
if key[0] == 'producto':
prod = key[1]
elif key[0] == 'precio':
prec = ' $'+key[1]
lister =[i,' ',prod,prec]
lista_01.append(lister)
imprimir_ticket(lista_01)
and this is the module that is responsible for generating the file:
en.py
from docx import Document
from docx.shared import Inches, Pt
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
import time
time = str(time.strftime("%H-%M-%S"))
def imprimir_ticket(lista_items):
doc = Document()
doc.add_heading(' Grupo Exxe',0)
for item in lista_items:
parrafo = doc.add_paragraph(item)
parrafo_formato = parrafo.paragraph_format
parrafo_formato.left_indent = Pt(155)
parrafo_formato.right_indent = Pt(155)
doc.add_page_break()
doc.save('C:/Users/Angel/Desktop/'+time+'.docx')
The problem is that trying to execute the script again does not generate the new document, it only generates a new document if I close the whole program and return it open.