51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
from typing import Dict, List, Optional, Any
|
|
|
|
|
|
def _extraire_infos_devis(doc, numero: str, champs_modifies: list) -> Dict:
|
|
"""Extrait les informations complètes du devis."""
|
|
total_ht = float(getattr(doc, "DO_TotalHT", 0.0))
|
|
total_ttc = float(getattr(doc, "DO_TotalTTC", 0.0))
|
|
statut = getattr(doc, "DO_Statut", 0)
|
|
reference = getattr(doc, "DO_Ref", "")
|
|
|
|
date_devis = None
|
|
try:
|
|
date_doc = getattr(doc, "DO_Date", None)
|
|
if date_doc:
|
|
date_devis = date_doc.strftime("%Y-%m-%d")
|
|
except Exception:
|
|
pass
|
|
|
|
date_livraison = None
|
|
try:
|
|
date_livr = getattr(doc, "DO_DateLivr", None)
|
|
if date_livr:
|
|
date_livraison = date_livr.strftime("%Y-%m-%d")
|
|
except Exception:
|
|
pass
|
|
|
|
client_code = ""
|
|
try:
|
|
client_obj = getattr(doc, "Client", None)
|
|
if client_obj:
|
|
client_obj.Read()
|
|
client_code = getattr(client_obj, "CT_Num", "")
|
|
except Exception:
|
|
pass
|
|
|
|
return {
|
|
"numero": numero,
|
|
"total_ht": total_ht,
|
|
"total_ttc": total_ttc,
|
|
"reference": reference,
|
|
"date_devis": date_devis,
|
|
"date_livraison": date_livraison,
|
|
"champs_modifies": champs_modifies,
|
|
"statut": statut,
|
|
"client_code": client_code,
|
|
}
|
|
|
|
|
|
__all__ = [
|
|
"_extraire_infos_devis",
|
|
]
|