From 4ae0178090efd4340ebad0685d20eb894b8bab5b Mon Sep 17 00:00:00 2001 From: fanilo Date: Sat, 3 Jan 2026 16:29:09 +0100 Subject: [PATCH] Create and update article functionnal but not, anymore, capable of handling "prix_achat" --- sage_connector.py | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/sage_connector.py b/sage_connector.py index d17167a..6b8387a 100644 --- a/sage_connector.py +++ b/sage_connector.py @@ -8708,6 +8708,27 @@ class SageConnector: try: article.Write() logger.info(" [OK] Write() réussi") + + # Vérification immédiate SQL + try: + with self._get_sql_connection() as conn: + cursor = conn.cursor() + cursor.execute( + """ + SELECT AR_PrixAch, AR_Coef, AR_Stat01, AR_Stat02 + FROM F_ARTICLE + WHERE AR_Ref = ? + """, + (reference.upper(),), + ) + verif_row = cursor.fetchone() + if verif_row: + logger.info( + f" [VERIF SQL] prix_achat={verif_row[0]}, coef={verif_row[1]}, stat01={verif_row[2]}, stat02={verif_row[3]}" + ) + except Exception as e_verif: + logger.warning(f" [VERIF SQL] Impossible : {e_verif}") + except Exception as e: error_detail = str(e) try: @@ -9033,7 +9054,6 @@ class SageConnector: raise RuntimeError("Connexion Sage non établie") try: - valide, erreur = valider_donnees_modification(article_data) if not valide: raise ValueError(erreur) @@ -9289,6 +9309,27 @@ class SageConnector: try: article.Write() logger.info("[ARTICLE] Write() réussi") + + # Vérification immédiate SQL + try: + with self._get_sql_connection() as conn: + cursor = conn.cursor() + cursor.execute( + """ + SELECT AR_PrixAch, AR_Coef, AR_Stat01, AR_Stat02 + FROM F_ARTICLE + WHERE AR_Ref = ? + """, + (reference.upper(),), + ) + verif_row = cursor.fetchone() + if verif_row: + logger.info( + f" [VERIF SQL] prix_achat={verif_row[0]}, coef={verif_row[1]}, stat01={verif_row[2]}, stat02={verif_row[3]}" + ) + except Exception as e_verif: + logger.warning(f" [VERIF SQL] Impossible : {e_verif}") + except Exception as e: error_detail = str(e) try: