Finalisation système check debitor

This commit is contained in:
Ambulance Clerc
2022-06-09 01:19:18 +02:00
parent d918e5b7aa
commit e8d1bf7696
3 changed files with 77 additions and 4 deletions

View File

@@ -121,3 +121,75 @@ class Check_addresses_popup(Toplevel):
self.wait_window(self)
return self.selection
class Check_debitor_popup(Toplevel):
x_row = 0
no_selection_possible = False
def __init__(self, parent, debitor=None, lists_available_names=None, factureID=None,fip=None,object=None):
super().__init__(parent)
self.object = object
self.debitor = debitor
self.inp_code = StringVar()
self.inp_code.set(debitor['code'])
self.geometry(f"850x300+{parent.winfo_x() + 25 }+{parent.winfo_y() +25 }")
self.resizable(True,True)
self.iconbitmap("./logo_clerc_03X_icon.ico")
self.title(f"Incohérence sur les débiteurs {fip}/{factureID}. Code débiteur: {debitor['code']}")
self.columnconfigure(0, weight=1)
self.columnconfigure(1, weight=1)
lbf_new = LabelFrame(self, text="Données Attrib")
lbf_new.grid(row=0, column=0, sticky='WE', padx=5, pady=5)
label_font = font.Font(weight='bold', size=9)
Label(lbf_new, text="Code saisi", font=label_font).grid(row=0, column=0, sticky="W")
Entry(lbf_new, textvariable=self.inp_code, width= 10).grid(row=0, column=1, sticky="W", pady= 10)
Label(lbf_new, text="Débiteur sélectionné", font=label_font).grid(row=1, column=0, sticky="W")
text_name = Text(lbf_new, fg="red", height=3,width= 30)
text_name.grid(row=1, column=1, sticky="W")
text_name.insert(END,debitor['name'])
text_name.configure(state='disabled')
lbf_old = LabelFrame(self, text="Nom possible")
lbf_old.grid(row=0, column=1, sticky='NSEW', padx=5, pady=5)
self.listbox = Text(lbf_old, height=5, width=50)
self.listbox.grid(row=1,column=0, columnspan= 2, pady=15,padx=15, sticky='NSEW')
for info in lists_available_names :
self.listbox.insert(END, f"{info}\n")
self.listbox.configure(state='disabled')
self.no_selection_possible = True
self.btn = Button(lbf_old, text="Ajouter", command=self.add)
self.btn.grid(row=2, column=0, columnspan= 2, pady=10, padx=10, sticky='NSEW')
self.btn = Button(self, text="Valider", command=self.destroy)
self.btn.grid(row=2,column=0, columnspan= 2, pady=10,padx=10, sticky='NSEW')
def add(self):
self.destroy()
if self.object is not None:
self.object.add_items(code=self.inp_code.get(), name=self.debitor["name"])
self.object.save_debitors()
def destroy(self):
super().destroy()
def show(self):
self.deiconify()
self.wm_protocol("WM_DELETE_WINDOW", self.destroy)
self.wait_window(self)
print("nouveau code = "+ self.inp_code.get())
return self.inp_code.get()