Spaces:
Running

hub / docs /implementation_plan.md
Andre
deploy: snapshot 84cae13 -- sales history por artigo + historias que expandem com paginacao (v1.3.62)
4152937
|
Raw History Blame Contribute Delete
4.06 kB

Gateway ERP — Implementation Status & Remaining Work

Last updated: 2026-04-17

Historical snapshot. The "Shipped Features" list below describes the app as it stood at commit b8b0ddc on 2026-04-17 and is deliberately left pinned to that date — it is a record, not the current picture. Several components it names (CreateItemForm, InvoiceImportModal, StockMovementModal) have since been removed. For the current structure see architecture.md; for what shipped when, see backend/release_notes.py. The "Remaining / Known Gaps" section at the bottom is kept current.

Shipped Features (as of commit b8b0ddc)

Data Model & Storage

  • Invoice / InvoiceLine tables with full Visma field set
  • Customer normalization and merge logic
  • BOM component relationships
  • ExchangeRateCache table (daily live-rate cache, singleton row)
  • Named Docker volume for SQLite (/app/data/inventory.db → volume backend_data)
  • Composite indexes migration for dashboard query performance

Backend API

  • Full inventory CRUD (/api/items, movement, history)
  • Audit log (EventLog) and global event stream
  • Dashboard analytics with triple-margin model (Kalkyl / FIFO / Avg)
  • SSE import endpoints (Visma articles/BOM/customers, invoices)
  • GET /api/exchange-rates — daily cached live rates (open.er-api.com), graceful fallback
  • GET /api/export/analytics/bom-costs — list and tree modes with anti-duplication rule
  • Additional export endpoints: revenue, inventory, customers, bom-comparison, bom-detail, suppliers, distributors, demand, accessories
  • Strategic analysis endpoints (BOM cost breakdown, mechanical/electronic classification, supplier matrix, top distributors, demand volume, accessory catalog, concentration analysis, freight intelligence)
  • snapshot_cost correctly maps to estimated_total_cost (Kalkylpris); actual_cost = last_purchase_price (FIFO); variance_sek / variance_pct exposed in ItemSchema

Frontend

  • Sidebar navigation: Revenue Analytics, Customer Analytics, Inventory & BOMs, Strategic Analysis
  • CurrencyProvider + GlobalCurrencySwitcher: SEK/EUR/USD with localStorage persistence and live rate bootstrap
  • useCurrencyConversion hook: memoized analytics conversion keyed on [data, ccy]
  • Full modal set: CreateItemForm, InvoiceImportModal, ItemDetailDrawer, StockMovementModal, VismaImportModal
  • AlertBar, ConfirmDialog, ErrorBoundary, Toast, ExecutiveSummary components
  • Export Costs button in Inventory list (list-mode CSV) and ItemDetailDrawer (tree-mode CSV)
  • Concentration analysis and freight intelligence dashboards
  • FreightDashboard, enhanced ServiceDashboard, RevenueDashboard, BOMAnalysis, SupplierMatrix, TopDistributors, AccessoryCatalog, DemandVolume

Testing

  • backend/tests/test_bom_costs_export.py — 11+ export unit tests (anti-duplication, list/tree modes, filter params)
  • frontend/tests/e2e.spec.ts — Playwright e2e tests including 4 currency switching scenarios

Remaining / Known Gaps

  • Dead stock improvement — Phase 1 designed in DEAD_STOCK_ANALYSIS.md: use last_movement_date for RAW items alongside last_sale_date; not yet implemented in code
  • No authentication — resolved. JWT cookie sessions, admin/viewer roles and hashed bearer tokens for non-interactive clients now gate the API (backend/auth.py, routers/api_tokens.py); see the Security Posture section of architecture.md
  • Currency coverage — Only SEK→EUR and SEK→USD supported. Adding more currencies requires extending CCY_RATES and CCY_SYMBOLS in frontend/src/utils/formatters.ts and restarting the app
  • ETL automation — largely resolved. A scheduled agent on the Visma host runs the extractors and uploads every bundle to the deployed app (etl/sync_to_hf.py, etl/force_sync_agent.py), and Admin → Data can request an on-demand sync. Raw Visma ADK files are still read on that host, not uploaded through the browser