Débug de la feature adresse_livraison

This commit is contained in:
Ambulance Clerc
2023-06-16 19:43:34 +02:00
parent 1146ff01c7
commit 5adbc77555
5 changed files with 24 additions and 15 deletions

View File

@@ -25,36 +25,44 @@ class cls_Invoice:
if debitor["name"] is not None:
concat_str += con + debitor["name"]
# con = "#chr(13)##chr(10)#"
con = "\r\n"
con = "\n"
if debitor["gender"] is not None:
concat_str += con + "Monsieur" if debitor["gender"] == "Masculin" else con + "Madame"
# con = "#chr(13)##chr(10)#"
con = "\r\n"
con = "\n"
if debitor["lastname"] is not None:
concat_str += con + self.ifNotNull(debitor["lastname"]) + " " + self.ifNotNull(
debitor["firstname"])
# con = "#chr(13)##chr(10)#"
con = "\r\n"
con = "\n"
if debitor["complement"] is not None:
concat_str += con + debitor["complement"]
# con = "#chr(13)##chr(10)#"
con = "\r\n"
con = "\n"
if debitor["street"] is not None:
concat_str += con + self.ifNotNull(debitor["street"]) + " " + self.ifNotNull(
debitor["street_number"])
# con = "#chr(13)##chr(10)#"
con = "\r\n"
con = "\n"
if debitor["city"] is not None:
concat_str += con + self.ifNotNull(debitor["postal_code"]) + " " + self.ifNotNull(
debitor["city"])
# con = "#chr(13)##chr(10)#"
con = "\r\n"
con = "\n"
if debitor["country_name"] != "Suisse":
concat_str += con + debitor["country_name"]
# con = "#chr(13)##chr(10)#"
con = "\r\n"
con = "\n"
self.Patient["addr_2"] = concat_str
self.Patient["selfish"] = self.is_addr_2_selfish(self.Patient)
def is_addr_2_selfish(self, patient):
print(patient)
temp_addr_2 = str(patient["addr_2"]).replace("Monsieur","").replace("Madame","").replace("\n","").replace(" ","")
str_compare = patient['lastname'].replace('.','') + patient['firstname'].replace('.','') + self.ifNotNull(patient['complement']).strip()+ patient['street'].strip() + patient['street_number'].strip() + patient['postal_code'].strip() + patient['city'].strip()
str_compare = str_compare.replace(" ","")
print(f"is_addr_2_selfish ? {str_compare} <> {temp_addr_2} = {str_compare == temp_addr_2}")
return str_compare == temp_addr_2
def ifNotNull(self, value, ret=""):
if value == None or value == "None":
return ret

View File

@@ -46,8 +46,8 @@ class Check_addresses_popup(Toplevel):
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="NPA/Localité:", str1=f"{item_1['postal_code']} {item_1['city']}", str2=f"{item_2.npa} {item_2.city}")
self.add_compares_element(new_frame=lbf_addr_2_new, old_frame=lbf_addr_2_old, label="Adresse livraison:", str1=item_1["addr_2"],
if int(debitor["code"]) < 100:
self.add_compares_element(new_frame=lbf_addr_2_new, old_frame=lbf_addr_2_old, label="Adresse livraison:", str1=item_1["addr_2"],
str2=self.ifNotNull(item_2.addr_2))
@@ -114,9 +114,9 @@ class Check_addresses_popup(Toplevel):
con = "*"
Label(new_frame, text=str(label), font=label_font).grid(row=self.x_row, column=0, sticky="W")
Label(new_frame, text=con + str(str1) + con, fg=value_color).grid(row=self.x_row, column=1, sticky="W")
Label(new_frame, text=con + str(str1) + con, fg=value_color, anchor="w", justify=LEFT).grid(row=self.x_row, column=1, sticky="W")
Label(old_frame, text=str(label), font=label_font).grid(row=self.x_row, column=0, sticky="W")
Label(old_frame, text=con + str(str2) + con, fg=value_color).grid(row=self.x_row, column=1, sticky="W")
Label(old_frame, text=con + str(str2) + con, fg=value_color, anchor="w", justify=LEFT).grid(row=self.x_row, column=1, sticky="W")
self.x_row += 1

View File

@@ -1 +1 @@
20230616-1729
20230616-1943

View File

@@ -303,7 +303,7 @@ class ClercAttrib2Biz():
o_addresse.street_cpl =str( record["AD_RUE_1"])
o_addresse.npa =str( record["AD_NPA"])
o_addresse.city = str(record["AD_VILLE"])
o_addresse.addr_2 = str(record["AD_ADR2"])
o_addresse.addr_2 = str(record["AD_ADR2"]).replace("\r\n","\n")
self.addresses.add_addresse(o_addresse)
logging.warning(f"Chargement du fichier adresses.dbf terminé ! {len(self.addresses.items)} adresses trouvées ")
else:
@@ -412,11 +412,12 @@ class ClercAttrib2Biz():
return False
if f"{new['postal_code']} {new['city']}" != f"{old.npa} {old.city}":
return False
if new["addr_2"] != old.addr_2:
if new["addr_2"] != old.addr_2 and not new["selfish"]:
return False
return True
def parseFile(self, data, filename):
self.progress_bar["value"] = 0
self.index_counter += 1

View File

@@ -1 +1 @@
VERSION = "20230616-1729"
VERSION = "20230616-1943"