diff --git a/sage_connector.py b/sage_connector.py index 6df70f5..14a8625 100644 --- a/sage_connector.py +++ b/sage_connector.py @@ -2444,9 +2444,18 @@ class SageConnector: client.CT_Intitule = intitule logger.debug(f" ✅ CT_Intitule: '{intitule}'") - # 2. Type (OBLIGATOIRE - 0=Client) - client.CT_Type = 0 - logger.debug(" ✅ CT_Type: 0 (Client)") + # 2. Qualité (OBLIGATOIRE pour distinguer Client/Fournisseur) + # CT_Qualite : 0=Aucune, 1=Client uniquement, 2=Fournisseur uniquement, 3=Client ET Fournisseur + try: + client.CT_Qualite = 1 # 1 = Client uniquement + logger.debug(" ✅ CT_Qualite: 1 (Client)") + except AttributeError: + # Fallback sur CT_Type si CT_Qualite n'existe pas + try: + client.CT_Type = 0 + logger.debug(" ✅ CT_Type: 0 (Client - ancienne version)") + except AttributeError: + logger.warning(" ⚠️ Ni CT_Qualite ni CT_Type disponible") # 3. Compte collectif if compte: