fix(dashboard): cache ROA price status and align nefacturate counts
- Add price_match column to SQLite, cached on order detail view - Background backfill on startup checks all unchecked imported orders - Extract _enrich_items_with_codmat() helper to deduplicate SKU enrichment - Attention card now shows same nefacturate count as filter pill Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -831,6 +831,20 @@ async def update_order_invoice(order_number: str, serie: str = None,
|
||||
await db.close()
|
||||
|
||||
|
||||
async def update_order_price_match(order_number: str, match: bool | None):
|
||||
"""Cache price_match result (True=OK, False=mismatch, None=unavailable)."""
|
||||
db = await get_sqlite()
|
||||
try:
|
||||
val = None if match is None else (1 if match else 0)
|
||||
await db.execute(
|
||||
"UPDATE orders SET price_match = ?, updated_at = datetime('now') WHERE order_number = ?",
|
||||
(val, order_number),
|
||||
)
|
||||
await db.commit()
|
||||
finally:
|
||||
await db.close()
|
||||
|
||||
|
||||
async def get_invoiced_imported_orders() -> list:
|
||||
"""Get imported orders that HAVE cached invoice data (for re-verification)."""
|
||||
db = await get_sqlite()
|
||||
|
||||
Reference in New Issue
Block a user