1.8.0¶
Released: TBD
Highlights¶
- Five new item-scoped analytics queries power the product inventory dashboard: a typed/filterable movement ledger, sales velocity & days-of-coverage, in-transit (open-PO) quantity, top clients, and a ranged stock-history series.
- Inventory log rows are now self-describing: a
source_typecolumn classifies each movement (sale / purchase / credit / adjustment), enabling reference-number and counterparty resolution in the movement ledger. - Saved landing-page filter views: tenant-shared, named filter configurations (stored as JSONB) per landing page, with full CRUD so the frontend can offer reusable "saved views".
Added¶
itemMovements(itemId, locationId, types, limit, offset): ItemMovementPage!— paginated, filterable movement ledger; each row carriesmovementType(VENTA/COMPRA/AJUSTE/ DEVOLUCION/OTHER),referenceNumber,counterpartyName,quantityChange,balanceAfter(running balance),unitValue/totalValue,createdBy,occurredAt.itemStockMetrics(itemId, windowDays, locationId): ItemStockMetrics!—unitsSoldInWindow,dailyVelocity,availableQuantity,daysOfCoverage,projectedStockoutDate.itemIncomingQuantity(itemId): Decimal!— quantity on open purchase orders not yet received.itemTopClients(itemId, windowDays, limit): [ItemTopClient!]!— top clients by net units sold.itemStockHistory(itemId, rangeDays, withEvents, locationId): ItemStockHistory!— daily stock points over a day-range with optional movement-event markers.MovementTypeenum andInventoryLogSourceType.- See Item Inventory Analytics.
landingPageConfigs(landingPage): [LandingPageConfig!]!andlandingPageConfig(id): LandingPageConfig— list/fetch tenant-shared saved filter configurations;createLandingPageConfig/updateLandingPageConfig(shared input,id: nullcreates) /deleteLandingPageConfig(write paths gated on theSETTINGSpath permission).LandingPageenum (one member per landing page) and theLandingPageConfigtype.- See Saved Landing-Page Filters.
Changed¶
InventoryRepository.update_quantitytakes an optionalsource_type; the invoice, credit, purchase-order and manual-adjustment write paths now populate it. The manual-adjustment path records the adjustment'ssource_id(wasNone).
Fixed¶
- None.
Migrations¶
add_inv_log_source_type(20260603_add_source_type_to_inventory_logs.py, down_revisionlegal_status_int_credits) — adds the nullableinventory_logs.source_typeinteger column and backfills it from the legacy free-textmethodcolumn.downgradedrops the column. No one-off scripts.add_landing_page_configs(20260603_add_landing_page_configs.py, down_revisionadd_inv_log_source_type) — creates thelanding_page_configstable (JSONBconfig,landing_pageenum,name, nullabledescription, auditcreated_by_id) with an index onlanding_page.downgradedrops the index and table. No one-off scripts.
Frontend impact¶
- Stock metric cards (Velocidad / Cobertura):
itemStockMetrics(itemId, windowDays: 30). - Posición de stock → "+N en tránsito":
itemIncomingQuantity(itemId). - Movimientos recientes + tabs:
itemMovements(itemId, types, limit, offset).movementTypedrives the Todos/Ventas/Compras/Ajustes/Devol. tabs;balanceAfteris the running-balance column; manual adjustments come back asAJUSTEwithreferenceNumber: null. - Top clientes (90d):
itemTopClients(itemId, windowDays: 90, limit: 4). - Histórico de stock (7/30/60/90D):
itemStockHistory(itemId, rangeDays, withEvents: true). - Static panels (Configuración de inventario, Stock actual/Físico/Disponible/Reservado,
Reorden recomendado) keep using
getItemById,availableQuantity,stockReservationsByItem. Decimalvalues come back as strings;daysOfCoverage/projectedStockoutDatearenullwhen velocity is 0 — render as "sin movimiento" rather than0.- Saved filter views: persist the active landing-page filter payload via
createLandingPageConfig(config)and re-apply by readingconfigback fromlandingPageConfigs(landingPage). Update is a full replace (send the whole object with itsid); configs are shared across the tenant andcreatedByIdis display/audit only.
Versioning notes¶
- MINOR bump (
scripts/bump_version.py 1.8.0 --changelog-stub): additive queries, types and two new columns/tables. No breaking schema change. Deploy order: the migrations chain linearly —add_inv_log_source_typethenadd_landing_page_configs; run both before/with the deploy. The inventory-log backfill makes historical rows queryable immediately; thelanding_page_configstable starts empty.