feat: enable including devis lines by default when listing devis.
This commit is contained in:
parent
cba39ad7ec
commit
8dda1191b3
2 changed files with 28 additions and 6 deletions
18
api.py
18
api.py
|
|
@ -367,14 +367,26 @@ async def creer_devis(devis: DevisRequest):
|
|||
|
||||
@app.get("/devis", tags=["US-A1"])
|
||||
async def lister_devis(
|
||||
limit: int = Query(100, le=1000), statut: Optional[int] = Query(None)
|
||||
limit: int = Query(100, le=1000),
|
||||
statut: Optional[int] = Query(None),
|
||||
inclure_lignes: bool = Query(
|
||||
True, description="Inclure les lignes de chaque devis"
|
||||
),
|
||||
):
|
||||
"""
|
||||
📋 Liste tous les devis via gateway Windows
|
||||
|
||||
Args:
|
||||
limit: Nombre maximum de devis à retourner
|
||||
statut: Filtre par statut (0=Devis, 2=Accepté, 5=Transformé, etc.)
|
||||
inclure_lignes: Si True, charge les lignes de chaque devis (par défaut: True)
|
||||
|
||||
✅ AMÉLIORATION: Les lignes sont maintenant incluses par défaut
|
||||
"""
|
||||
try:
|
||||
# ✅ APPEL VIA SAGE_CLIENT (HTTP vers Windows)
|
||||
devis_list = sage_client.lister_devis(limit=limit, statut=statut)
|
||||
devis_list = sage_client.lister_devis(
|
||||
limit=limit, statut=statut, inclure_lignes=inclure_lignes
|
||||
)
|
||||
return devis_list
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -98,10 +98,20 @@ class SageGatewayClient:
|
|||
return self._post("/sage/devis/get", {"code": numero}).get("data")
|
||||
|
||||
def lister_devis(
|
||||
self, limit: int = 100, statut: Optional[int] = None
|
||||
self,
|
||||
limit: int = 100,
|
||||
statut: Optional[int] = None,
|
||||
inclure_lignes: bool = True,
|
||||
) -> List[Dict]:
|
||||
"""✅ NOUVEAU: Liste tous les devis avec filtres"""
|
||||
payload = {"limit": limit}
|
||||
"""
|
||||
✅ NOUVEAU: Liste tous les devis avec filtres
|
||||
|
||||
Args:
|
||||
limit: Nombre max de devis
|
||||
statut: Filtre par statut (optionnel)
|
||||
inclure_lignes: Si True, charge les lignes de chaque devis (par défaut: True)
|
||||
"""
|
||||
payload = {"limit": limit, "inclure_lignes": inclure_lignes}
|
||||
if statut is not None:
|
||||
payload["statut"] = statut
|
||||
return self._post("/sage/devis/list", payload).get("data", [])
|
||||
|
|
|
|||
Loading…
Reference in a new issue