diff --git a/api/app/routers/sync.py b/api/app/routers/sync.py index ed8e7ba..d416589 100644 --- a/api/app/routers/sync.py +++ b/api/app/routers/sync.py @@ -332,7 +332,7 @@ async def order_detail(order_number: str): # Enrich with invoice data order = detail.get("order", {}) - if order.get("factura_numar"): + if order.get("factura_numar") and order.get("factura_data"): order["invoice"] = { "facturat": True, "serie_act": order.get("factura_serie"), @@ -396,8 +396,8 @@ async def dashboard_orders(page: int = 1, per_page: int = 50, # Enrich orders with invoice data — prefer SQLite cache, fallback to Oracle all_orders = result["orders"] for o in all_orders: - if o.get("factura_numar"): - # Use cached invoice data from SQLite + if o.get("factura_numar") and o.get("factura_data"): + # Use cached invoice data from SQLite (only if complete) o["invoice"] = { "facturat": True, "serie_act": o.get("factura_serie"),