Removed non-ASCII characters
This commit is contained in:
parent
31dec46226
commit
3dd863accf
5 changed files with 137 additions and 137 deletions
12
main.py
12
main.py
|
|
@ -86,7 +86,7 @@ sage: Optional[SageConnector] = None
|
||||||
def startup():
|
def startup():
|
||||||
global sage
|
global sage
|
||||||
|
|
||||||
logger.info("🚀 Démarrage Sage Gateway Windows...")
|
logger.info(" Démarrage Sage Gateway Windows...")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
validate_settings()
|
validate_settings()
|
||||||
|
|
@ -113,7 +113,7 @@ def startup():
|
||||||
def shutdown():
|
def shutdown():
|
||||||
if sage:
|
if sage:
|
||||||
sage.deconnecter()
|
sage.deconnecter()
|
||||||
logger.info("👋 Sage Gateway arrêté")
|
logger.info(" Sage Gateway arrêté")
|
||||||
|
|
||||||
|
|
||||||
@app.get("/health")
|
@app.get("/health")
|
||||||
|
|
@ -323,7 +323,7 @@ def transformer_document(
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"🔄 Transformation demandée: {numero_source} "
|
f" Transformation demandée: {numero_source} "
|
||||||
f"(type {type_source}) → type {type_cible}"
|
f"(type {type_source}) → type {type_cible}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -796,7 +796,7 @@ def creer_avoir_endpoint(req: AvoirCreate):
|
||||||
@app.post("/sage/avoirs/update", dependencies=[Depends(verify_token)])
|
@app.post("/sage/avoirs/update", dependencies=[Depends(verify_token)])
|
||||||
def modifier_avoir_endpoint(req: AvoirUpdate):
|
def modifier_avoir_endpoint(req: AvoirUpdate):
|
||||||
"""
|
"""
|
||||||
✏️ Modification d'un avoir dans Sage
|
️ Modification d'un avoir dans Sage
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
resultat = sage.modifier_avoir(req.numero, req.avoir_data)
|
resultat = sage.modifier_avoir(req.numero, req.avoir_data)
|
||||||
|
|
@ -1182,7 +1182,7 @@ def lister_depots():
|
||||||
def creer_entree_stock(req: EntreeStock):
|
def creer_entree_stock(req: EntreeStock):
|
||||||
try:
|
try:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"📦 [ENTREE STOCK] Création bon d'entrée : {len(req.lignes)} ligne(s)"
|
f" [ENTREE STOCK] Création bon d'entrée : {len(req.lignes)} ligne(s)"
|
||||||
)
|
)
|
||||||
|
|
||||||
entree_data = {
|
entree_data = {
|
||||||
|
|
@ -1212,7 +1212,7 @@ def creer_entree_stock(req: EntreeStock):
|
||||||
def creer_sortie_stock(req: SortieStock):
|
def creer_sortie_stock(req: SortieStock):
|
||||||
try:
|
try:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"📤 [SORTIE STOCK] Création bon de sortie : {len(req.lignes)} ligne(s)"
|
f" [SORTIE STOCK] Création bon de sortie : {len(req.lignes)} ligne(s)"
|
||||||
)
|
)
|
||||||
|
|
||||||
sortie_data = {
|
sortie_data = {
|
||||||
|
|
|
||||||
|
|
@ -262,12 +262,12 @@ class SageConnector:
|
||||||
fournisseurs.append(fournisseur)
|
fournisseurs.append(fournisseur)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"✓ SQL: {len(fournisseurs)} fournisseurs avec {len(fournisseur)} champs"
|
f" SQL: {len(fournisseurs)} fournisseurs avec {len(fournisseur)} champs"
|
||||||
)
|
)
|
||||||
return fournisseurs
|
return fournisseurs
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"✗ Erreur SQL fournisseurs: {e}")
|
logger.error(f" Erreur SQL fournisseurs: {e}")
|
||||||
raise RuntimeError(f"Erreur lecture fournisseurs: {str(e)}")
|
raise RuntimeError(f"Erreur lecture fournisseurs: {str(e)}")
|
||||||
|
|
||||||
def lire_fournisseur(self, code_fournisseur):
|
def lire_fournisseur(self, code_fournisseur):
|
||||||
|
|
@ -293,12 +293,12 @@ class SageConnector:
|
||||||
fournisseur["contacts"] = _get_contacts(row.CT_Num, conn)
|
fournisseur["contacts"] = _get_contacts(row.CT_Num, conn)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"✓ SQL: Fournisseur {code_fournisseur} avec {len(fournisseur)} champs"
|
f" SQL: Fournisseur {code_fournisseur} avec {len(fournisseur)} champs"
|
||||||
)
|
)
|
||||||
return fournisseur
|
return fournisseur
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"✗ Erreur SQL fournisseur {code_fournisseur}: {e}")
|
logger.error(f" Erreur SQL fournisseur {code_fournisseur}: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def creer_fournisseur(self, fournisseur_data: Dict) -> Dict:
|
def creer_fournisseur(self, fournisseur_data: Dict) -> Dict:
|
||||||
|
|
@ -775,11 +775,11 @@ class SageConnector:
|
||||||
client["contacts"] = _get_contacts(row.CT_Num, conn)
|
client["contacts"] = _get_contacts(row.CT_Num, conn)
|
||||||
clients.append(client)
|
clients.append(client)
|
||||||
|
|
||||||
logger.info(f"✓ SQL: {len(clients)} clients avec {len(client)} champs")
|
logger.info(f" SQL: {len(clients)} clients avec {len(client)} champs")
|
||||||
return clients
|
return clients
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"✗ Erreur SQL clients: {e}")
|
logger.error(f" Erreur SQL clients: {e}")
|
||||||
raise RuntimeError(f"Erreur lecture clients: {str(e)}")
|
raise RuntimeError(f"Erreur lecture clients: {str(e)}")
|
||||||
|
|
||||||
def lire_client(self, code_client):
|
def lire_client(self, code_client):
|
||||||
|
|
@ -804,11 +804,11 @@ class SageConnector:
|
||||||
client = tiers_to_dict(row)
|
client = tiers_to_dict(row)
|
||||||
client["contacts"] = _get_contacts(row.CT_Num, conn)
|
client["contacts"] = _get_contacts(row.CT_Num, conn)
|
||||||
|
|
||||||
logger.info(f"✓ SQL: Client {code_client} avec {len(client)} champs")
|
logger.info(f" SQL: Client {code_client} avec {len(client)} champs")
|
||||||
return client
|
return client
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"✗ Erreur SQL client {code_client}: {e}")
|
logger.error(f" Erreur SQL client {code_client}: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def lister_tous_articles(self, filtre=""):
|
def lister_tous_articles(self, filtre=""):
|
||||||
|
|
@ -1147,11 +1147,11 @@ class SageConnector:
|
||||||
articles = enrichir_prix_gammes(articles, cursor)
|
articles = enrichir_prix_gammes(articles, cursor)
|
||||||
articles = enrichir_conditionnements(articles, cursor)
|
articles = enrichir_conditionnements(articles, cursor)
|
||||||
|
|
||||||
logger.info(f"✓ Article {reference} lu avec tous les enrichissements")
|
logger.info(f" Article {reference} lu avec tous les enrichissements")
|
||||||
return articles[0]
|
return articles[0]
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"✗ Erreur SQL article {reference}: {e}", exc_info=True)
|
logger.error(f" Erreur SQL article {reference}: {e}", exc_info=True)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def obtenir_contact(self, numero: str, contact_numero: int) -> Optional[Dict]:
|
def obtenir_contact(self, numero: str, contact_numero: int) -> Optional[Dict]:
|
||||||
|
|
@ -1440,7 +1440,7 @@ class SageConnector:
|
||||||
if nb_lignes_source == 0:
|
if nb_lignes_source == 0:
|
||||||
raise ValueError(f"Document {numero_source} vide (0 lignes)")
|
raise ValueError(f"Document {numero_source} vide (0 lignes)")
|
||||||
|
|
||||||
logger.info("[TRANSFORM] 🔧 Création du transformer...")
|
logger.info("[TRANSFORM] Création du transformer...")
|
||||||
|
|
||||||
transformation = getattr(self.cial, "Transformation", None)
|
transformation = getattr(self.cial, "Transformation", None)
|
||||||
if not transformation:
|
if not transformation:
|
||||||
|
|
@ -1874,7 +1874,7 @@ class SageConnector:
|
||||||
persist_tiers = factory_client.ReadNumero(numero_client)
|
persist_tiers = factory_client.ReadNumero(numero_client)
|
||||||
if persist_tiers:
|
if persist_tiers:
|
||||||
type_tiers = "Client"
|
type_tiers = "Client"
|
||||||
logger.info(" ✓ Trouvé comme Client")
|
logger.info(" Trouvé comme Client")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f" Pas trouvé comme Client: {e}")
|
logger.debug(f" Pas trouvé comme Client: {e}")
|
||||||
|
|
||||||
|
|
@ -1884,7 +1884,7 @@ class SageConnector:
|
||||||
persist_tiers = factory_fournisseur.ReadNumero(numero_client)
|
persist_tiers = factory_fournisseur.ReadNumero(numero_client)
|
||||||
if persist_tiers:
|
if persist_tiers:
|
||||||
type_tiers = "Fournisseur"
|
type_tiers = "Fournisseur"
|
||||||
logger.info(" ✓ Trouvé comme Fournisseur")
|
logger.info(" Trouvé comme Fournisseur")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f" Pas trouvé comme Fournisseur: {e}")
|
logger.debug(f" Pas trouvé comme Fournisseur: {e}")
|
||||||
|
|
||||||
|
|
@ -2082,7 +2082,7 @@ class SageConnector:
|
||||||
|
|
||||||
if not contact_no:
|
if not contact_no:
|
||||||
logger.info(
|
logger.info(
|
||||||
" 🔍 CT_No non disponible via COM - Recherche en base..."
|
" CT_No non disponible via COM - Recherche en base..."
|
||||||
)
|
)
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
@ -2113,7 +2113,7 @@ class SageConnector:
|
||||||
or "already exists" in erreur_com.lower()
|
or "already exists" in erreur_com.lower()
|
||||||
):
|
):
|
||||||
logger.info(
|
logger.info(
|
||||||
" 🔍 Erreur 'existe déjà' détectée - Vérification en base..."
|
" Erreur 'existe déjà' détectée - Vérification en base..."
|
||||||
)
|
)
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
@ -2342,7 +2342,7 @@ class SageConnector:
|
||||||
persist_tiers = factory_client.ReadNumero(numero)
|
persist_tiers = factory_client.ReadNumero(numero)
|
||||||
if persist_tiers:
|
if persist_tiers:
|
||||||
type_tiers = "Client"
|
type_tiers = "Client"
|
||||||
logger.info(" ✓ Trouvé comme Client")
|
logger.info(" Trouvé comme Client")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f" Pas trouvé comme Client: {e}")
|
logger.debug(f" Pas trouvé comme Client: {e}")
|
||||||
|
|
||||||
|
|
@ -2352,7 +2352,7 @@ class SageConnector:
|
||||||
persist_tiers = factory_fournisseur.ReadNumero(numero)
|
persist_tiers = factory_fournisseur.ReadNumero(numero)
|
||||||
if persist_tiers:
|
if persist_tiers:
|
||||||
type_tiers = "Fournisseur"
|
type_tiers = "Fournisseur"
|
||||||
logger.info(" ✓ Trouvé comme Fournisseur")
|
logger.info(" Trouvé comme Fournisseur")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f" Pas trouvé comme Fournisseur: {e}")
|
logger.debug(f" Pas trouvé comme Fournisseur: {e}")
|
||||||
|
|
||||||
|
|
@ -4720,7 +4720,7 @@ class SageConnector:
|
||||||
article.AR_PrixVen = float(article_data["prix_vente"])
|
article.AR_PrixVen = float(article_data["prix_vente"])
|
||||||
champs_appliques.append("prix_vente")
|
champs_appliques.append("prix_vente")
|
||||||
logger.info(
|
logger.info(
|
||||||
f" ✓ prix_vente = {article_data['prix_vente']}"
|
f" prix_vente = {article_data['prix_vente']}"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"prix_vente: {e}")
|
champs_echoues.append(f"prix_vente: {e}")
|
||||||
|
|
@ -4730,7 +4730,7 @@ class SageConnector:
|
||||||
article.AR_PrixAchat = float(article_data["prix_achat"])
|
article.AR_PrixAchat = float(article_data["prix_achat"])
|
||||||
champs_appliques.append("prix_achat")
|
champs_appliques.append("prix_achat")
|
||||||
logger.info(
|
logger.info(
|
||||||
f" ✓ prix_achat = {article_data['prix_achat']}"
|
f" prix_achat = {article_data['prix_achat']}"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"prix_achat: {e}")
|
champs_echoues.append(f"prix_achat: {e}")
|
||||||
|
|
@ -4739,7 +4739,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Coef = float(article_data["coef"])
|
article.AR_Coef = float(article_data["coef"])
|
||||||
champs_appliques.append("coef")
|
champs_appliques.append("coef")
|
||||||
logger.info(f" ✓ coef = {article_data['coef']}")
|
logger.info(f" coef = {article_data['coef']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"coef: {e}")
|
champs_echoues.append(f"coef: {e}")
|
||||||
|
|
||||||
|
|
@ -4747,7 +4747,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_CodeBarre = str(article_data["code_ean"])
|
article.AR_CodeBarre = str(article_data["code_ean"])
|
||||||
champs_appliques.append("code_ean")
|
champs_appliques.append("code_ean")
|
||||||
logger.info(f" ✓ code_ean = {article_data['code_ean']}")
|
logger.info(f" code_ean = {article_data['code_ean']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"code_ean: {e}")
|
champs_echoues.append(f"code_ean: {e}")
|
||||||
|
|
||||||
|
|
@ -4755,7 +4755,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Langue1 = str(article_data["description"])[:255]
|
article.AR_Langue1 = str(article_data["description"])[:255]
|
||||||
champs_appliques.append("description")
|
champs_appliques.append("description")
|
||||||
logger.info(" ✓ description définie (AR_Langue1)")
|
logger.info(" description définie (AR_Langue1)")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"description: {e}")
|
champs_echoues.append(f"description: {e}")
|
||||||
|
|
||||||
|
|
@ -4763,7 +4763,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Pays = str(article_data["pays"])[:3].upper()
|
article.AR_Pays = str(article_data["pays"])[:3].upper()
|
||||||
champs_appliques.append("pays")
|
champs_appliques.append("pays")
|
||||||
logger.info(f" ✓ pays = {article_data['pays']}")
|
logger.info(f" pays = {article_data['pays']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"pays: {e}")
|
champs_echoues.append(f"pays: {e}")
|
||||||
|
|
||||||
|
|
@ -4771,7 +4771,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Garantie = int(article_data["garantie"])
|
article.AR_Garantie = int(article_data["garantie"])
|
||||||
champs_appliques.append("garantie")
|
champs_appliques.append("garantie")
|
||||||
logger.info(f" ✓ garantie = {article_data['garantie']}")
|
logger.info(f" garantie = {article_data['garantie']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"garantie: {e}")
|
champs_echoues.append(f"garantie: {e}")
|
||||||
|
|
||||||
|
|
@ -4779,7 +4779,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Delai = int(article_data["delai"])
|
article.AR_Delai = int(article_data["delai"])
|
||||||
champs_appliques.append("delai")
|
champs_appliques.append("delai")
|
||||||
logger.info(f" ✓ delai = {article_data['delai']}")
|
logger.info(f" delai = {article_data['delai']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"delai: {e}")
|
champs_echoues.append(f"delai: {e}")
|
||||||
|
|
||||||
|
|
@ -4787,7 +4787,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_PoidsNet = float(article_data["poids_net"])
|
article.AR_PoidsNet = float(article_data["poids_net"])
|
||||||
champs_appliques.append("poids_net")
|
champs_appliques.append("poids_net")
|
||||||
logger.info(f" ✓ poids_net = {article_data['poids_net']}")
|
logger.info(f" poids_net = {article_data['poids_net']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"poids_net: {e}")
|
champs_echoues.append(f"poids_net: {e}")
|
||||||
|
|
||||||
|
|
@ -4796,7 +4796,7 @@ class SageConnector:
|
||||||
article.AR_PoidsBrut = float(article_data["poids_brut"])
|
article.AR_PoidsBrut = float(article_data["poids_brut"])
|
||||||
champs_appliques.append("poids_brut")
|
champs_appliques.append("poids_brut")
|
||||||
logger.info(
|
logger.info(
|
||||||
f" ✓ poids_brut = {article_data['poids_brut']}"
|
f" poids_brut = {article_data['poids_brut']}"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"poids_brut: {e}")
|
champs_echoues.append(f"poids_brut: {e}")
|
||||||
|
|
@ -4808,7 +4808,7 @@ class SageConnector:
|
||||||
]
|
]
|
||||||
champs_appliques.append("code_fiscal")
|
champs_appliques.append("code_fiscal")
|
||||||
logger.info(
|
logger.info(
|
||||||
f" ✓ code_fiscal = {article_data['code_fiscal']}"
|
f" code_fiscal = {article_data['code_fiscal']}"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"code_fiscal: {e}")
|
champs_echoues.append(f"code_fiscal: {e}")
|
||||||
|
|
@ -4820,7 +4820,7 @@ class SageConnector:
|
||||||
)
|
)
|
||||||
champs_appliques.append("soumis_escompte")
|
champs_appliques.append("soumis_escompte")
|
||||||
logger.info(
|
logger.info(
|
||||||
f" ✓ soumis_escompte = {article_data['soumis_escompte']}"
|
f" soumis_escompte = {article_data['soumis_escompte']}"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"soumis_escompte: {e}")
|
champs_echoues.append(f"soumis_escompte: {e}")
|
||||||
|
|
@ -4829,7 +4829,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Publie = 1 if article_data["publie"] else 0
|
article.AR_Publie = 1 if article_data["publie"] else 0
|
||||||
champs_appliques.append("publie")
|
champs_appliques.append("publie")
|
||||||
logger.info(f" ✓ publie = {article_data['publie']}")
|
logger.info(f" publie = {article_data['publie']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"publie: {e}")
|
champs_echoues.append(f"publie: {e}")
|
||||||
|
|
||||||
|
|
@ -4838,7 +4838,7 @@ class SageConnector:
|
||||||
article.AR_Sommeil = 1 if article_data["en_sommeil"] else 0
|
article.AR_Sommeil = 1 if article_data["en_sommeil"] else 0
|
||||||
champs_appliques.append("en_sommeil")
|
champs_appliques.append("en_sommeil")
|
||||||
logger.info(
|
logger.info(
|
||||||
f" ✓ en_sommeil = {article_data['en_sommeil']}"
|
f" en_sommeil = {article_data['en_sommeil']}"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"en_sommeil: {e}")
|
champs_echoues.append(f"en_sommeil: {e}")
|
||||||
|
|
@ -4880,13 +4880,13 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
for index, value in stats_a_definir:
|
for index, value in stats_a_definir:
|
||||||
article.AR_Stat(index, value)
|
article.AR_Stat(index, value)
|
||||||
logger.info(f" ✓ stat_0{index + 1} = {value}")
|
logger.info(f" stat_0{index + 1} = {value}")
|
||||||
champs_appliques.append(f"stat_0{index + 1}")
|
champs_appliques.append(f"stat_0{index + 1}")
|
||||||
|
|
||||||
article.Write()
|
article.Write()
|
||||||
logger.info(" [OK] Statistiques sauvegardées")
|
logger.info(" [OK] Statistiques sauvegardées")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f" ⚠ Statistiques : {e}")
|
logger.warning(f" Statistiques : {e}")
|
||||||
|
|
||||||
if transaction_active:
|
if transaction_active:
|
||||||
try:
|
try:
|
||||||
|
|
@ -5314,7 +5314,7 @@ class SageConnector:
|
||||||
designation = str(article_data["designation"])[:69].strip()
|
designation = str(article_data["designation"])[:69].strip()
|
||||||
article.AR_Design = designation
|
article.AR_Design = designation
|
||||||
champs_modifies.append("designation")
|
champs_modifies.append("designation")
|
||||||
logger.info(f" ✓ designation = {designation}")
|
logger.info(f" designation = {designation}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"designation: {e}")
|
champs_echoues.append(f"designation: {e}")
|
||||||
|
|
||||||
|
|
@ -5322,7 +5322,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_PrixVen = float(article_data["prix_vente"])
|
article.AR_PrixVen = float(article_data["prix_vente"])
|
||||||
champs_modifies.append("prix_vente")
|
champs_modifies.append("prix_vente")
|
||||||
logger.info(f" ✓ prix_vente = {article_data['prix_vente']}")
|
logger.info(f" prix_vente = {article_data['prix_vente']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"prix_vente: {e}")
|
champs_echoues.append(f"prix_vente: {e}")
|
||||||
|
|
||||||
|
|
@ -5330,7 +5330,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_PrixAchat = float(article_data["prix_achat"])
|
article.AR_PrixAchat = float(article_data["prix_achat"])
|
||||||
champs_modifies.append("prix_achat")
|
champs_modifies.append("prix_achat")
|
||||||
logger.info(f" ✓ prix_achat = {article_data['prix_achat']}")
|
logger.info(f" prix_achat = {article_data['prix_achat']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"prix_achat: {e}")
|
champs_echoues.append(f"prix_achat: {e}")
|
||||||
|
|
||||||
|
|
@ -5338,7 +5338,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Coef = float(article_data["coef"])
|
article.AR_Coef = float(article_data["coef"])
|
||||||
champs_modifies.append("coef")
|
champs_modifies.append("coef")
|
||||||
logger.info(f" ✓ coef = {article_data['coef']}")
|
logger.info(f" coef = {article_data['coef']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"coef: {e}")
|
champs_echoues.append(f"coef: {e}")
|
||||||
|
|
||||||
|
|
@ -5348,7 +5348,7 @@ class SageConnector:
|
||||||
:13
|
:13
|
||||||
].strip()
|
].strip()
|
||||||
champs_modifies.append("code_ean")
|
champs_modifies.append("code_ean")
|
||||||
logger.info(f" ✓ code_ean = {article_data['code_ean']}")
|
logger.info(f" code_ean = {article_data['code_ean']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"code_ean: {e}")
|
champs_echoues.append(f"code_ean: {e}")
|
||||||
|
|
||||||
|
|
@ -5358,7 +5358,7 @@ class SageConnector:
|
||||||
:255
|
:255
|
||||||
].strip()
|
].strip()
|
||||||
champs_modifies.append("description")
|
champs_modifies.append("description")
|
||||||
logger.info(" ✓ description définie (AR_Langue1)")
|
logger.info(" description définie (AR_Langue1)")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"description: {e}")
|
champs_echoues.append(f"description: {e}")
|
||||||
|
|
||||||
|
|
@ -5366,7 +5366,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Pays = str(article_data["pays"])[:3].upper()
|
article.AR_Pays = str(article_data["pays"])[:3].upper()
|
||||||
champs_modifies.append("pays")
|
champs_modifies.append("pays")
|
||||||
logger.info(f" ✓ pays = {article_data['pays']}")
|
logger.info(f" pays = {article_data['pays']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"pays: {e}")
|
champs_echoues.append(f"pays: {e}")
|
||||||
|
|
||||||
|
|
@ -5374,7 +5374,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Garantie = int(article_data["garantie"])
|
article.AR_Garantie = int(article_data["garantie"])
|
||||||
champs_modifies.append("garantie")
|
champs_modifies.append("garantie")
|
||||||
logger.info(f" ✓ garantie = {article_data['garantie']}")
|
logger.info(f" garantie = {article_data['garantie']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"garantie: {e}")
|
champs_echoues.append(f"garantie: {e}")
|
||||||
|
|
||||||
|
|
@ -5382,7 +5382,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Delai = int(article_data["delai"])
|
article.AR_Delai = int(article_data["delai"])
|
||||||
champs_modifies.append("delai")
|
champs_modifies.append("delai")
|
||||||
logger.info(f" ✓ delai = {article_data['delai']}")
|
logger.info(f" delai = {article_data['delai']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"delai: {e}")
|
champs_echoues.append(f"delai: {e}")
|
||||||
|
|
||||||
|
|
@ -5390,7 +5390,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_PoidsNet = float(article_data["poids_net"])
|
article.AR_PoidsNet = float(article_data["poids_net"])
|
||||||
champs_modifies.append("poids_net")
|
champs_modifies.append("poids_net")
|
||||||
logger.info(f" ✓ poids_net = {article_data['poids_net']}")
|
logger.info(f" poids_net = {article_data['poids_net']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"poids_net: {e}")
|
champs_echoues.append(f"poids_net: {e}")
|
||||||
|
|
||||||
|
|
@ -5398,7 +5398,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_PoidsBrut = float(article_data["poids_brut"])
|
article.AR_PoidsBrut = float(article_data["poids_brut"])
|
||||||
champs_modifies.append("poids_brut")
|
champs_modifies.append("poids_brut")
|
||||||
logger.info(f" ✓ poids_brut = {article_data['poids_brut']}")
|
logger.info(f" poids_brut = {article_data['poids_brut']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"poids_brut: {e}")
|
champs_echoues.append(f"poids_brut: {e}")
|
||||||
|
|
||||||
|
|
@ -5406,7 +5406,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_CodeFiscal = str(article_data["code_fiscal"])[:10]
|
article.AR_CodeFiscal = str(article_data["code_fiscal"])[:10]
|
||||||
champs_modifies.append("code_fiscal")
|
champs_modifies.append("code_fiscal")
|
||||||
logger.info(f" ✓ code_fiscal = {article_data['code_fiscal']}")
|
logger.info(f" code_fiscal = {article_data['code_fiscal']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"code_fiscal: {e}")
|
champs_echoues.append(f"code_fiscal: {e}")
|
||||||
|
|
||||||
|
|
@ -5417,7 +5417,7 @@ class SageConnector:
|
||||||
)
|
)
|
||||||
champs_modifies.append("soumis_escompte")
|
champs_modifies.append("soumis_escompte")
|
||||||
logger.info(
|
logger.info(
|
||||||
f" ✓ soumis_escompte = {article_data['soumis_escompte']}"
|
f" soumis_escompte = {article_data['soumis_escompte']}"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"soumis_escompte: {e}")
|
champs_echoues.append(f"soumis_escompte: {e}")
|
||||||
|
|
@ -5426,7 +5426,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Publie = 1 if article_data["publie"] else 0
|
article.AR_Publie = 1 if article_data["publie"] else 0
|
||||||
champs_modifies.append("publie")
|
champs_modifies.append("publie")
|
||||||
logger.info(f" ✓ publie = {article_data['publie']}")
|
logger.info(f" publie = {article_data['publie']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"publie: {e}")
|
champs_echoues.append(f"publie: {e}")
|
||||||
|
|
||||||
|
|
@ -5434,7 +5434,7 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
article.AR_Sommeil = 1 if article_data["en_sommeil"] else 0
|
article.AR_Sommeil = 1 if article_data["en_sommeil"] else 0
|
||||||
champs_modifies.append("en_sommeil")
|
champs_modifies.append("en_sommeil")
|
||||||
logger.info(f" ✓ en_sommeil = {article_data['en_sommeil']}")
|
logger.info(f" en_sommeil = {article_data['en_sommeil']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
champs_echoues.append(f"en_sommeil: {e}")
|
champs_echoues.append(f"en_sommeil: {e}")
|
||||||
|
|
||||||
|
|
@ -5484,13 +5484,13 @@ class SageConnector:
|
||||||
try:
|
try:
|
||||||
for index, value in stats_a_modifier:
|
for index, value in stats_a_modifier:
|
||||||
article.AR_Stat(index, value)
|
article.AR_Stat(index, value)
|
||||||
logger.info(f" ✓ stat_0{index + 1} = {value}")
|
logger.info(f" stat_0{index + 1} = {value}")
|
||||||
champs_modifies.append(f"stat_0{index + 1}")
|
champs_modifies.append(f"stat_0{index + 1}")
|
||||||
|
|
||||||
article.Write()
|
article.Write()
|
||||||
logger.info(" [OK] Statistiques sauvegardées")
|
logger.info(" [OK] Statistiques sauvegardées")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f" ⚠ Statistiques : {e}")
|
logger.warning(f" Statistiques : {e}")
|
||||||
|
|
||||||
if "stock_mini" in article_data or "stock_maxi" in article_data:
|
if "stock_mini" in article_data or "stock_maxi" in article_data:
|
||||||
try:
|
try:
|
||||||
|
|
@ -7357,12 +7357,12 @@ class SageConnector:
|
||||||
tiers_list.append(tiers)
|
tiers_list.append(tiers)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"✓ SQL: {len(tiers_list)} tiers retournés (type={type_tiers}, filtre={filtre})"
|
f" SQL: {len(tiers_list)} tiers retournés (type={type_tiers}, filtre={filtre})"
|
||||||
)
|
)
|
||||||
return tiers_list
|
return tiers_list
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"✗ Erreur SQL tiers: {e}")
|
logger.error(f" Erreur SQL tiers: {e}")
|
||||||
raise RuntimeError(f"Erreur lecture tiers: {str(e)}")
|
raise RuntimeError(f"Erreur lecture tiers: {str(e)}")
|
||||||
|
|
||||||
def lire_tiers(self, code: str) -> Optional[Dict]:
|
def lire_tiers(self, code: str) -> Optional[Dict]:
|
||||||
|
|
@ -7387,11 +7387,11 @@ class SageConnector:
|
||||||
tiers = tiers_to_dict(row)
|
tiers = tiers_to_dict(row)
|
||||||
tiers["contacts"] = _get_contacts(row.CT_Num, conn)
|
tiers["contacts"] = _get_contacts(row.CT_Num, conn)
|
||||||
|
|
||||||
logger.info(f"✓ SQL: Tiers {code} lu avec succès")
|
logger.info(f" SQL: Tiers {code} lu avec succès")
|
||||||
return tiers
|
return tiers
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"✗ Erreur SQL tiers {code}: {e}")
|
logger.error(f" Erreur SQL tiers {code}: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def lister_tous_collaborateurs(self, filtre="", actifs_seulement=True):
|
def lister_tous_collaborateurs(self, filtre="", actifs_seulement=True):
|
||||||
|
|
@ -7429,11 +7429,11 @@ class SageConnector:
|
||||||
|
|
||||||
collaborateurs = [collaborators_to_dict(row) for row in rows]
|
collaborateurs = [collaborators_to_dict(row) for row in rows]
|
||||||
|
|
||||||
logger.info(f"✓ SQL: {len(collaborateurs)} collaborateurs")
|
logger.info(f" SQL: {len(collaborateurs)} collaborateurs")
|
||||||
return collaborateurs
|
return collaborateurs
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"✗ Erreur SQL collaborateurs: {e}")
|
logger.error(f" Erreur SQL collaborateurs: {e}")
|
||||||
raise RuntimeError(f"Erreur lecture collaborateurs: {str(e)}")
|
raise RuntimeError(f"Erreur lecture collaborateurs: {str(e)}")
|
||||||
|
|
||||||
def lire_collaborateur(self, numero):
|
def lire_collaborateur(self, numero):
|
||||||
|
|
@ -7464,12 +7464,12 @@ class SageConnector:
|
||||||
collaborateur = collaborators_to_dict(row)
|
collaborateur = collaborators_to_dict(row)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"✓ SQL: Collaborateur {numero} avec {len(collaborateur)} champs"
|
f" SQL: Collaborateur {numero} avec {len(collaborateur)} champs"
|
||||||
)
|
)
|
||||||
return collaborateur
|
return collaborateur
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"✗ Erreur SQL collaborateur {numero}: {e}")
|
logger.error(f" Erreur SQL collaborateur {numero}: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def creer_collaborateur(self, data: dict) -> dict:
|
def creer_collaborateur(self, data: dict) -> dict:
|
||||||
|
|
@ -7484,12 +7484,12 @@ class SageConnector:
|
||||||
prenom = str(data.get("prenom", "")).strip()[:35] if data.get("prenom") else ""
|
prenom = str(data.get("prenom", "")).strip()[:35] if data.get("prenom") else ""
|
||||||
|
|
||||||
logger.info(f"\n{'=' * 70}")
|
logger.info(f"\n{'=' * 70}")
|
||||||
logger.info(f"📝 CRÉATION COLLABORATEUR: {nom_upper} {prenom}")
|
logger.info(f" CRÉATION COLLABORATEUR: {nom_upper} {prenom}")
|
||||||
logger.info(f"{'=' * 70}")
|
logger.info(f"{'=' * 70}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with self._com_context(), self._lock_com:
|
with self._com_context(), self._lock_com:
|
||||||
logger.info("🔍 Vérification doublon...")
|
logger.info(" Vérification doublon...")
|
||||||
with self._get_sql_connection() as conn:
|
with self._get_sql_connection() as conn:
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
|
|
@ -7501,7 +7501,7 @@ class SageConnector:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Le collaborateur '{nom_upper} {prenom}' existe déjà (N°{existing[0]})"
|
f"Le collaborateur '{nom_upper} {prenom}' existe déjà (N°{existing[0]})"
|
||||||
)
|
)
|
||||||
logger.info("✓ Pas de doublon")
|
logger.info(" Pas de doublon")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
factory = self.cial.FactoryCollaborateur
|
factory = self.cial.FactoryCollaborateur
|
||||||
|
|
@ -7518,7 +7518,7 @@ class SageConnector:
|
||||||
]:
|
]:
|
||||||
try:
|
try:
|
||||||
collab = win32com.client.CastTo(persist, iface)
|
collab = win32com.client.CastTo(persist, iface)
|
||||||
logger.info(f"✓ Cast vers {iface}")
|
logger.info(f" Cast vers {iface}")
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
@ -7527,7 +7527,7 @@ class SageConnector:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
collab.SetDefault()
|
collab.SetDefault()
|
||||||
logger.info("✓ SetDefault()")
|
logger.info(" SetDefault()")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"SetDefault() ignoré: {e}")
|
logger.warning(f"SetDefault() ignoré: {e}")
|
||||||
|
|
||||||
|
|
@ -7540,13 +7540,13 @@ class SageConnector:
|
||||||
if max_len:
|
if max_len:
|
||||||
val = val[:max_len]
|
val = val[:max_len]
|
||||||
setattr(obj, attr, val)
|
setattr(obj, attr, val)
|
||||||
logger.debug(f" ✓ {attr} = '{val}'")
|
logger.debug(f" {attr} = '{val}'")
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f" ✗ {attr}: {e}")
|
logger.warning(f" {attr}: {e}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.info("📝 Champs directs...")
|
logger.info(" Champs directs...")
|
||||||
|
|
||||||
safe_set(collab, "Nom", nom_upper, 35)
|
safe_set(collab, "Nom", nom_upper, 35)
|
||||||
|
|
||||||
|
|
@ -7558,7 +7558,7 @@ class SageConnector:
|
||||||
safe_set(collab, "LinkedIn", data.get("linkedin"), 35)
|
safe_set(collab, "LinkedIn", data.get("linkedin"), 35)
|
||||||
safe_set(collab, "Skype", data.get("skype"), 35)
|
safe_set(collab, "Skype", data.get("skype"), 35)
|
||||||
|
|
||||||
logger.info("📍 Adresse...")
|
logger.info(" Adresse...")
|
||||||
try:
|
try:
|
||||||
adresse_obj = collab.Adresse
|
adresse_obj = collab.Adresse
|
||||||
safe_set(adresse_obj, "Adresse", data.get("adresse"), 35)
|
safe_set(adresse_obj, "Adresse", data.get("adresse"), 35)
|
||||||
|
|
@ -7568,9 +7568,9 @@ class SageConnector:
|
||||||
safe_set(adresse_obj, "CodeRegion", data.get("code_region"), 25)
|
safe_set(adresse_obj, "CodeRegion", data.get("code_region"), 25)
|
||||||
safe_set(adresse_obj, "Pays", data.get("pays"), 35)
|
safe_set(adresse_obj, "Pays", data.get("pays"), 35)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"⚠️ Erreur Adresse: {e}")
|
logger.warning(f"️ Erreur Adresse: {e}")
|
||||||
|
|
||||||
logger.info("📞 Telecom...")
|
logger.info(" Telecom...")
|
||||||
try:
|
try:
|
||||||
telecom_obj = collab.Telecom
|
telecom_obj = collab.Telecom
|
||||||
safe_set(telecom_obj, "Telephone", data.get("telephone"), 21)
|
safe_set(telecom_obj, "Telephone", data.get("telephone"), 21)
|
||||||
|
|
@ -7578,13 +7578,13 @@ class SageConnector:
|
||||||
safe_set(telecom_obj, "EMail", data.get("email"), 69)
|
safe_set(telecom_obj, "EMail", data.get("email"), 69)
|
||||||
safe_set(telecom_obj, "Portable", data.get("tel_portable"), 21)
|
safe_set(telecom_obj, "Portable", data.get("tel_portable"), 21)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"⚠️ Erreur Telecom: {e}")
|
logger.warning(f"️ Erreur Telecom: {e}")
|
||||||
|
|
||||||
logger.info("🔘 Booléens...")
|
logger.info(" Booléens...")
|
||||||
if data.get("vendeur") is True:
|
if data.get("vendeur") is True:
|
||||||
try:
|
try:
|
||||||
collab.Vendeur = True
|
collab.Vendeur = True
|
||||||
logger.debug(" ✓ Vendeur = True")
|
logger.debug(" Vendeur = True")
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
if data.get("caissier") is True:
|
if data.get("caissier") is True:
|
||||||
|
|
@ -7608,7 +7608,7 @@ class SageConnector:
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
logger.info("💾 Write()...")
|
logger.info(" Write()...")
|
||||||
try:
|
try:
|
||||||
collab.Write()
|
collab.Write()
|
||||||
logger.info(" Write() RÉUSSI!")
|
logger.info(" Write() RÉUSSI!")
|
||||||
|
|
@ -7657,7 +7657,7 @@ class SageConnector:
|
||||||
return {"nom": nom_upper, "prenom": prenom, "status": "créé"}
|
return {"nom": nom_upper, "prenom": prenom, "status": "créé"}
|
||||||
|
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logger.warning(f"⚠️ Validation: {e}")
|
logger.warning(f"️ Validation: {e}")
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f" Erreur création collaborateur: {e}", exc_info=True)
|
logger.error(f" Erreur création collaborateur: {e}", exc_info=True)
|
||||||
|
|
@ -7669,7 +7669,7 @@ class SageConnector:
|
||||||
raise RuntimeError("Connexion Sage non établie")
|
raise RuntimeError("Connexion Sage non établie")
|
||||||
|
|
||||||
logger.info(f"\n{'=' * 70}")
|
logger.info(f"\n{'=' * 70}")
|
||||||
logger.info(f"📝 MODIFICATION COLLABORATEUR N°{numero}")
|
logger.info(f" MODIFICATION COLLABORATEUR N°{numero}")
|
||||||
logger.info(f"{'=' * 70}")
|
logger.info(f"{'=' * 70}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -7695,7 +7695,7 @@ class SageConnector:
|
||||||
]:
|
]:
|
||||||
try:
|
try:
|
||||||
collab = win32com.client.CastTo(persist, iface)
|
collab = win32com.client.CastTo(persist, iface)
|
||||||
logger.info(f"✓ Cast vers {iface}")
|
logger.info(f" Cast vers {iface}")
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
@ -7704,7 +7704,7 @@ class SageConnector:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
collab.Read()
|
collab.Read()
|
||||||
logger.info(f"✓ Collaborateur {numero} chargé")
|
logger.info(f" Collaborateur {numero} chargé")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Read() ignoré: {e}")
|
logger.warning(f"Read() ignoré: {e}")
|
||||||
|
|
||||||
|
|
@ -7717,15 +7717,15 @@ class SageConnector:
|
||||||
if max_len and isinstance(val, str):
|
if max_len and isinstance(val, str):
|
||||||
val = val[:max_len]
|
val = val[:max_len]
|
||||||
setattr(obj, attr, val)
|
setattr(obj, attr, val)
|
||||||
logger.debug(f" ✓ {attr} = '{val}'")
|
logger.debug(f" {attr} = '{val}'")
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f" ✗ {attr}: {e}")
|
logger.warning(f" {attr}: {e}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
champs_modifies = []
|
champs_modifies = []
|
||||||
|
|
||||||
logger.info("📝 Champs directs...")
|
logger.info(" Champs directs...")
|
||||||
|
|
||||||
champs_directs = {
|
champs_directs = {
|
||||||
"nom": ("Nom", 35),
|
"nom": ("Nom", 35),
|
||||||
|
|
@ -7746,7 +7746,7 @@ class SageConnector:
|
||||||
if safe_set(collab, sage_attr, val, max_len):
|
if safe_set(collab, sage_attr, val, max_len):
|
||||||
champs_modifies.append(sage_attr)
|
champs_modifies.append(sage_attr)
|
||||||
|
|
||||||
logger.info("📍 Adresse...")
|
logger.info(" Adresse...")
|
||||||
try:
|
try:
|
||||||
adresse_obj = collab.Adresse
|
adresse_obj = collab.Adresse
|
||||||
|
|
||||||
|
|
@ -7767,9 +7767,9 @@ class SageConnector:
|
||||||
champs_modifies.append(f"Adresse.{sage_attr}")
|
champs_modifies.append(f"Adresse.{sage_attr}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"⚠️ Erreur accès Adresse: {e}")
|
logger.warning(f"️ Erreur accès Adresse: {e}")
|
||||||
|
|
||||||
logger.info("📞 Telecom...")
|
logger.info(" Telecom...")
|
||||||
try:
|
try:
|
||||||
telecom_obj = collab.Telecom
|
telecom_obj = collab.Telecom
|
||||||
|
|
||||||
|
|
@ -7788,9 +7788,9 @@ class SageConnector:
|
||||||
champs_modifies.append(f"Telecom.{sage_attr}")
|
champs_modifies.append(f"Telecom.{sage_attr}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"⚠️ Erreur accès Telecom: {e}")
|
logger.warning(f"️ Erreur accès Telecom: {e}")
|
||||||
|
|
||||||
logger.info("🔘 Booléens...")
|
logger.info(" Booléens...")
|
||||||
|
|
||||||
champs_bool = {
|
champs_bool = {
|
||||||
"vendeur": "Vendeur",
|
"vendeur": "Vendeur",
|
||||||
|
|
@ -7806,19 +7806,19 @@ class SageConnector:
|
||||||
val = bool(data[py_field])
|
val = bool(data[py_field])
|
||||||
setattr(collab, sage_attr, val)
|
setattr(collab, sage_attr, val)
|
||||||
champs_modifies.append(sage_attr)
|
champs_modifies.append(sage_attr)
|
||||||
logger.debug(f" ✓ {sage_attr} = {val}")
|
logger.debug(f" {sage_attr} = {val}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f" ✗ {sage_attr}: {e}")
|
logger.warning(f" {sage_attr}: {e}")
|
||||||
|
|
||||||
if not champs_modifies:
|
if not champs_modifies:
|
||||||
logger.info("ℹ️ Aucun champ à modifier")
|
logger.info("ℹ️ Aucun champ à modifier")
|
||||||
return self.lire_collaborateur(numero)
|
return self.lire_collaborateur(numero)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"📋 {len(champs_modifies)} champ(s) à modifier: {champs_modifies}"
|
f" {len(champs_modifies)} champ(s) à modifier: {champs_modifies}"
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info("💾 Write()...")
|
logger.info(" Write()...")
|
||||||
try:
|
try:
|
||||||
collab.Write()
|
collab.Write()
|
||||||
logger.info(" Write() RÉUSSI!")
|
logger.info(" Write() RÉUSSI!")
|
||||||
|
|
@ -7833,7 +7833,7 @@ class SageConnector:
|
||||||
return self.lire_collaborateur(numero)
|
return self.lire_collaborateur(numero)
|
||||||
|
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logger.warning(f"⚠️ Validation: {e}")
|
logger.warning(f"️ Validation: {e}")
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f" Erreur modification collaborateur: {e}", exc_info=True)
|
logger.error(f" Erreur modification collaborateur: {e}", exc_info=True)
|
||||||
|
|
@ -7861,12 +7861,12 @@ class SageConnector:
|
||||||
societe.update(logo_com)
|
societe.update(logo_com)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"✓ Informations société '{societe['raison_sociale']}' lues"
|
f" Informations société '{societe['raison_sociale']}' lues"
|
||||||
)
|
)
|
||||||
return societe
|
return societe
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"✗ Erreur lecture P_DOSSIER: {e}", exc_info=True)
|
logger.error(f" Erreur lecture P_DOSSIER: {e}", exc_info=True)
|
||||||
raise RuntimeError(f"Erreur lecture informations société: {str(e)}")
|
raise RuntimeError(f"Erreur lecture informations société: {str(e)}")
|
||||||
|
|
||||||
def regler_facture(
|
def regler_facture(
|
||||||
|
|
|
||||||
|
|
@ -1185,7 +1185,7 @@ def enrichir_fournisseurs_articles(articles: List[Dict], cursor) -> List[Dict]:
|
||||||
)
|
)
|
||||||
|
|
||||||
if not nums_fournisseurs:
|
if not nums_fournisseurs:
|
||||||
logger.warning(" ⚠ Aucun numéro de fournisseur trouvé dans les articles")
|
logger.warning(" Aucun numéro de fournisseur trouvé dans les articles")
|
||||||
for article in articles:
|
for article in articles:
|
||||||
article["fournisseur_nom"] = None
|
article["fournisseur_nom"] = None
|
||||||
return articles
|
return articles
|
||||||
|
|
@ -1211,7 +1211,7 @@ def enrichir_fournisseurs_articles(articles: List[Dict], cursor) -> List[Dict]:
|
||||||
|
|
||||||
if len(fournisseur_rows) == 0:
|
if len(fournisseur_rows) == 0:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f" ⚠ Aucun fournisseur trouvé pour CT_Type=1 et CT_Num IN {nums_fournisseurs[:5]}"
|
f" Aucun fournisseur trouvé pour CT_Type=1 et CT_Num IN {nums_fournisseurs[:5]}"
|
||||||
)
|
)
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
f"SELECT CT_Num, CT_Type FROM F_COMPTET WHERE CT_Num IN ({placeholders})",
|
f"SELECT CT_Num, CT_Type FROM F_COMPTET WHERE CT_Num IN ({placeholders})",
|
||||||
|
|
@ -1273,7 +1273,7 @@ def enrichir_familles_articles(articles: List[Dict], cursor) -> List[Dict]:
|
||||||
)
|
)
|
||||||
|
|
||||||
if not codes_familles:
|
if not codes_familles:
|
||||||
logger.warning(" ⚠ Aucun code famille trouvé dans les articles")
|
logger.warning(" Aucun code famille trouvé dans les articles")
|
||||||
for article in articles:
|
for article in articles:
|
||||||
_init_champs_famille_vides(article)
|
_init_champs_famille_vides(article)
|
||||||
return articles
|
return articles
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,7 @@ def devalider_facture(connector, numero_facture: str) -> Dict:
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"❌ Erreur COM dévalidation {numero_facture}: {e}", exc_info=True)
|
logger.error(f" Erreur COM dévalidation {numero_facture}: {e}", exc_info=True)
|
||||||
raise RuntimeError(f"Échec dévalidation: {str(e)}")
|
raise RuntimeError(f"Échec dévalidation: {str(e)}")
|
||||||
|
|
||||||
info_apres = _get_facture_info_sql(connector, numero_facture)
|
info_apres = _get_facture_info_sql(connector, numero_facture)
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ def creer_document_vente(
|
||||||
|
|
||||||
config = ConfigDocument(type_document)
|
config = ConfigDocument(type_document)
|
||||||
logger.info(
|
logger.info(
|
||||||
f"📝 Début création {config.nom_document} pour client {doc_data['client']['code']}"
|
f" Début création {config.nom_document} pour client {doc_data['client']['code']}"
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -30,7 +30,7 @@ def creer_document_vente(
|
||||||
try:
|
try:
|
||||||
self.cial.CptaApplication.BeginTrans()
|
self.cial.CptaApplication.BeginTrans()
|
||||||
transaction_active = True
|
transaction_active = True
|
||||||
logger.debug("✓ Transaction Sage démarrée")
|
logger.debug(" Transaction Sage démarrée")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"BeginTrans échoué (non critique): {e}")
|
logger.warning(f"BeginTrans échoué (non critique): {e}")
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ def creer_document_vente(
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
logger.info(f"✓ Document {config.nom_document} créé")
|
logger.info(f" Document {config.nom_document} créé")
|
||||||
|
|
||||||
date_principale = normaliser_date(
|
date_principale = normaliser_date(
|
||||||
doc_data.get(config.champ_date_principale)
|
doc_data.get(config.champ_date_principale)
|
||||||
|
|
@ -64,7 +64,7 @@ def creer_document_vente(
|
||||||
normaliser_date(doc_data[config.champ_date_secondaire])
|
normaliser_date(doc_data[config.champ_date_secondaire])
|
||||||
)
|
)
|
||||||
logger.info(
|
logger.info(
|
||||||
f"✓ {config.champ_date_secondaire}: {doc_data[config.champ_date_secondaire]}"
|
f" {config.champ_date_secondaire}: {doc_data[config.champ_date_secondaire]}"
|
||||||
)
|
)
|
||||||
|
|
||||||
factory_client = self.cial.CptaApplication.FactoryClient
|
factory_client = self.cial.CptaApplication.FactoryClient
|
||||||
|
|
@ -79,12 +79,12 @@ def creer_document_vente(
|
||||||
|
|
||||||
doc.SetDefaultClient(client_obj)
|
doc.SetDefaultClient(client_obj)
|
||||||
doc.Write()
|
doc.Write()
|
||||||
logger.info(f"✓ Client {doc_data['client']['code']} associé")
|
logger.info(f" Client {doc_data['client']['code']} associé")
|
||||||
|
|
||||||
if doc_data.get("reference"):
|
if doc_data.get("reference"):
|
||||||
try:
|
try:
|
||||||
doc.DO_Ref = doc_data["reference"]
|
doc.DO_Ref = doc_data["reference"]
|
||||||
logger.info(f"✓ Référence: {doc_data['reference']}")
|
logger.info(f" Référence: {doc_data['reference']}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Référence non définie: {e}")
|
logger.warning(f"Référence non définie: {e}")
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@ def creer_document_vente(
|
||||||
|
|
||||||
factory_article = self.cial.FactoryArticle
|
factory_article = self.cial.FactoryArticle
|
||||||
|
|
||||||
logger.info(f"📦 Ajout de {len(doc_data['lignes'])} lignes...")
|
logger.info(f" Ajout de {len(doc_data['lignes'])} lignes...")
|
||||||
|
|
||||||
for idx, ligne_data in enumerate(doc_data["lignes"], 1):
|
for idx, ligne_data in enumerate(doc_data["lignes"], 1):
|
||||||
_ajouter_ligne_document(
|
_ajouter_ligne_document(
|
||||||
|
|
@ -110,7 +110,7 @@ def creer_document_vente(
|
||||||
doc=doc,
|
doc=doc,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info("💾 Validation du document...")
|
logger.info(" Validation du document...")
|
||||||
|
|
||||||
if type_document == TypeDocumentVente.FACTURE:
|
if type_document == TypeDocumentVente.FACTURE:
|
||||||
try:
|
try:
|
||||||
|
|
@ -126,18 +126,18 @@ def creer_document_vente(
|
||||||
|
|
||||||
if type_document != TypeDocumentVente.DEVIS:
|
if type_document != TypeDocumentVente.DEVIS:
|
||||||
process.Process()
|
process.Process()
|
||||||
logger.info("✓ Process() appelé")
|
logger.info(" Process() appelé")
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
process.Process()
|
process.Process()
|
||||||
logger.info("✓ Process() appelé (devis)")
|
logger.info(" Process() appelé (devis)")
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.debug(" ↳ Process() ignoré pour devis brouillon")
|
logger.debug(" ↳ Process() ignoré pour devis brouillon")
|
||||||
|
|
||||||
if transaction_active:
|
if transaction_active:
|
||||||
try:
|
try:
|
||||||
self.cial.CptaApplication.CommitTrans()
|
self.cial.CptaApplication.CommitTrans()
|
||||||
logger.info("✓ Transaction committée")
|
logger.info(" Transaction committée")
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -150,7 +150,7 @@ def creer_document_vente(
|
||||||
f"Numéro {config.nom_document} vide après création"
|
f"Numéro {config.nom_document} vide après création"
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info(f"📄 Numéro: {numero_document}")
|
logger.info(f" Numéro: {numero_document}")
|
||||||
|
|
||||||
doc_final_data = _relire_document_final(
|
doc_final_data = _relire_document_final(
|
||||||
self,
|
self,
|
||||||
|
|
@ -252,21 +252,21 @@ def _ajouter_ligne_document(
|
||||||
ligne_obj.DL_PrixUnitaire = float(prix_sage)
|
ligne_obj.DL_PrixUnitaire = float(prix_sage)
|
||||||
|
|
||||||
prix_final = float(getattr(ligne_obj, "DL_PrixUnitaire", 0))
|
prix_final = float(getattr(ligne_obj, "DL_PrixUnitaire", 0))
|
||||||
logger.info(f" 💰 Prix: {prix_final}€")
|
logger.info(f" Prix: {prix_final}€")
|
||||||
|
|
||||||
ligne_obj.Write()
|
ligne_obj.Write()
|
||||||
|
|
||||||
remise = ligne_data.get("remise_pourcentage", 0)
|
remise = ligne_data.get("remise_pourcentage", 0)
|
||||||
if remise and remise > 0:
|
if remise and remise > 0:
|
||||||
logger.info(f" 🎯 Application remise {remise}%...")
|
logger.info(f" Application remise {remise}%...")
|
||||||
_appliquer_remise_ligne(ligne_obj, remise)
|
_appliquer_remise_ligne(ligne_obj, remise)
|
||||||
|
|
||||||
logger.info(f" ✓ Ligne {idx} terminée")
|
logger.info(f" Ligne {idx} terminée")
|
||||||
|
|
||||||
|
|
||||||
def _configurer_facture(self, doc) -> None:
|
def _configurer_facture(self, doc) -> None:
|
||||||
"""Configuration spécifique pour les factures"""
|
"""Configuration spécifique pour les factures"""
|
||||||
logger.info(" 🔧 Configuration spécifique facture...")
|
logger.info(" Configuration spécifique facture...")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if hasattr(doc, "DO_CodeJournal"):
|
if hasattr(doc, "DO_CodeJournal"):
|
||||||
|
|
@ -274,24 +274,24 @@ def _configurer_facture(self, doc) -> None:
|
||||||
param_societe = self.cial.CptaApplication.ParametreSociete
|
param_societe = self.cial.CptaApplication.ParametreSociete
|
||||||
journal_defaut = getattr(param_societe, "P_CodeJournalVte", "VTE")
|
journal_defaut = getattr(param_societe, "P_CodeJournalVte", "VTE")
|
||||||
doc.DO_CodeJournal = journal_defaut
|
doc.DO_CodeJournal = journal_defaut
|
||||||
logger.debug(f" ✓ Code journal: {journal_defaut}")
|
logger.debug(f" Code journal: {journal_defaut}")
|
||||||
except Exception:
|
except Exception:
|
||||||
doc.DO_CodeJournal = "VTE"
|
doc.DO_CodeJournal = "VTE"
|
||||||
logger.debug(" ✓ Code journal: VTE (défaut)")
|
logger.debug(" Code journal: VTE (défaut)")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f" Code journal: {e}")
|
logger.debug(f" Code journal: {e}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if hasattr(doc, "DO_Souche"):
|
if hasattr(doc, "DO_Souche"):
|
||||||
doc.DO_Souche = 0
|
doc.DO_Souche = 0
|
||||||
logger.debug(" ✓ Souche: 0")
|
logger.debug(" Souche: 0")
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if hasattr(doc, "DO_Regime"):
|
if hasattr(doc, "DO_Regime"):
|
||||||
doc.DO_Regime = 0
|
doc.DO_Regime = 0
|
||||||
logger.debug(" ✓ Régime: 0")
|
logger.debug(" Régime: 0")
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -390,11 +390,11 @@ def modifier_document_vente(
|
||||||
raise RuntimeError("Connexion Sage non établie")
|
raise RuntimeError("Connexion Sage non établie")
|
||||||
|
|
||||||
config = ConfigDocument(type_document)
|
config = ConfigDocument(type_document)
|
||||||
logger.info(f"📝 === MODIFICATION {config.nom_document.upper()} {numero} ===")
|
logger.info(f" === MODIFICATION {config.nom_document.upper()} {numero} ===")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with self._com_context(), self._lock_com:
|
with self._com_context(), self._lock_com:
|
||||||
logger.info("📂 Chargement document...")
|
logger.info(" Chargement document...")
|
||||||
factory = self.cial.FactoryDocumentVente
|
factory = self.cial.FactoryDocumentVente
|
||||||
persist = None
|
persist = None
|
||||||
|
|
||||||
|
|
@ -403,7 +403,7 @@ def modifier_document_vente(
|
||||||
persist_test = factory.ReadPiece(type_test, numero)
|
persist_test = factory.ReadPiece(type_test, numero)
|
||||||
if persist_test:
|
if persist_test:
|
||||||
persist = persist_test
|
persist = persist_test
|
||||||
logger.info(f" ✓ Document trouvé (type={type_test})")
|
logger.info(f" Document trouvé (type={type_test})")
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
|
|
@ -466,7 +466,7 @@ def modifier_document_vente(
|
||||||
modif_ref = "reference" in doc_data
|
modif_ref = "reference" in doc_data
|
||||||
modif_lignes = "lignes" in doc_data and doc_data["lignes"] is not None
|
modif_lignes = "lignes" in doc_data and doc_data["lignes"] is not None
|
||||||
|
|
||||||
logger.info("📋 Modifications demandées:")
|
logger.info(" Modifications demandées:")
|
||||||
logger.info(f" {config.champ_date_principale}: {modif_date}")
|
logger.info(f" {config.champ_date_principale}: {modif_date}")
|
||||||
if config.champ_date_secondaire:
|
if config.champ_date_secondaire:
|
||||||
logger.info(f" {config.champ_date_secondaire}: {modif_date_sec}")
|
logger.info(f" {config.champ_date_secondaire}: {modif_date_sec}")
|
||||||
|
|
@ -486,11 +486,11 @@ def modifier_document_vente(
|
||||||
statut_a_modifier = doc_data_temp.pop("statut")
|
statut_a_modifier = doc_data_temp.pop("statut")
|
||||||
modif_statut = False
|
modif_statut = False
|
||||||
|
|
||||||
logger.info("🔍 Test Write() basique...")
|
logger.info(" Test Write() basique...")
|
||||||
try:
|
try:
|
||||||
doc.Write()
|
doc.Write()
|
||||||
doc.Read()
|
doc.Read()
|
||||||
logger.info(" ✓ Write() basique OK")
|
logger.info(" Write() basique OK")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f" Document verrouillé: {e}")
|
logger.error(f" Document verrouillé: {e}")
|
||||||
raise ValueError(f"Document verrouillé: {e}")
|
raise ValueError(f"Document verrouillé: {e}")
|
||||||
|
|
@ -498,7 +498,7 @@ def modifier_document_vente(
|
||||||
if not modif_lignes and (
|
if not modif_lignes and (
|
||||||
modif_date or modif_date_sec or modif_statut or modif_ref
|
modif_date or modif_date_sec or modif_statut or modif_ref
|
||||||
):
|
):
|
||||||
logger.info("📝 Modifications simples...")
|
logger.info(" Modifications simples...")
|
||||||
|
|
||||||
if modif_date:
|
if modif_date:
|
||||||
date_principale = normaliser_date(
|
date_principale = normaliser_date(
|
||||||
|
|
@ -529,10 +529,10 @@ def modifier_document_vente(
|
||||||
_configurer_facture(self, doc)
|
_configurer_facture(self, doc)
|
||||||
|
|
||||||
doc.Write()
|
doc.Write()
|
||||||
logger.info(" ✓ Modifications appliquées")
|
logger.info(" Modifications appliquées")
|
||||||
|
|
||||||
elif modif_lignes:
|
elif modif_lignes:
|
||||||
logger.info("🔄 REMPLACEMENT COMPLET DES LIGNES...")
|
logger.info(" REMPLACEMENT COMPLET DES LIGNES...")
|
||||||
|
|
||||||
if modif_date:
|
if modif_date:
|
||||||
doc.DO_Date = pywintypes.Time(
|
doc.DO_Date = pywintypes.Time(
|
||||||
|
|
@ -562,7 +562,7 @@ def modifier_document_vente(
|
||||||
factory_article = self.cial.FactoryArticle
|
factory_article = self.cial.FactoryArticle
|
||||||
|
|
||||||
if nb_lignes_initial > 0:
|
if nb_lignes_initial > 0:
|
||||||
logger.info(f" 🗑️ Suppression {nb_lignes_initial} lignes...")
|
logger.info(f" ️ Suppression {nb_lignes_initial} lignes...")
|
||||||
for idx in range(nb_lignes_initial, 0, -1):
|
for idx in range(nb_lignes_initial, 0, -1):
|
||||||
try:
|
try:
|
||||||
ligne_p = factory_lignes.List(idx)
|
ligne_p = factory_lignes.List(idx)
|
||||||
|
|
@ -574,9 +574,9 @@ def modifier_document_vente(
|
||||||
ligne.Remove()
|
ligne.Remove()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f" Ligne {idx}: {e}")
|
logger.warning(f" Ligne {idx}: {e}")
|
||||||
logger.info(" ✓ Lignes supprimées")
|
logger.info(" Lignes supprimées")
|
||||||
|
|
||||||
logger.info(f" ➕ Ajout {nb_nouvelles} lignes...")
|
logger.info(f" Ajout {nb_nouvelles} lignes...")
|
||||||
for idx, ligne_data in enumerate(nouvelles_lignes, 1):
|
for idx, ligne_data in enumerate(nouvelles_lignes, 1):
|
||||||
_ajouter_ligne_document(
|
_ajouter_ligne_document(
|
||||||
cial=self.cial,
|
cial=self.cial,
|
||||||
|
|
@ -587,7 +587,7 @@ def modifier_document_vente(
|
||||||
doc=doc,
|
doc=doc,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info(" ✓ Nouvelles lignes ajoutées avec remises")
|
logger.info(" Nouvelles lignes ajoutées avec remises")
|
||||||
|
|
||||||
doc.Write()
|
doc.Write()
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
@ -598,7 +598,7 @@ def modifier_document_vente(
|
||||||
if reference_a_modifier is not None:
|
if reference_a_modifier is not None:
|
||||||
try:
|
try:
|
||||||
logger.info(
|
logger.info(
|
||||||
f" 📝 Modification référence: '{reference_a_modifier}'"
|
f" Modification référence: '{reference_a_modifier}'"
|
||||||
)
|
)
|
||||||
doc.DO_Ref = (
|
doc.DO_Ref = (
|
||||||
str(reference_a_modifier) if reference_a_modifier else ""
|
str(reference_a_modifier) if reference_a_modifier else ""
|
||||||
|
|
@ -612,7 +612,7 @@ def modifier_document_vente(
|
||||||
|
|
||||||
if statut_a_modifier is not None:
|
if statut_a_modifier is not None:
|
||||||
try:
|
try:
|
||||||
logger.info(f" 📝 Modification statut: {statut_a_modifier}")
|
logger.info(f" Modification statut: {statut_a_modifier}")
|
||||||
doc.DO_Statut = int(statut_a_modifier)
|
doc.DO_Statut = int(statut_a_modifier)
|
||||||
doc.Write()
|
doc.Write()
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue