fix: corregir ventas y mejorar catalogos

This commit is contained in:
mono
2026-10-25 18:40:00 -05:00
parent 6da4996cec
commit 9900235250
13 changed files with 274 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ export class VentasService {
throw new Error('La venta debe tener cantidades mayores que cero');
}
// Validar stock mínimo conceptual - se puede expandir
return db.transaction('rw', db.ventas, db.ventaLineas, async () => {
return db.transaction('rw', db.ventas, db.ventaLineas, db.movimientosInventario, async () => {
for (const linea of lineas) {
const movimientos = await db.movimientosInventario.where('productoId').equals(linea.productoId).toArray();
const stock = movimientos.reduce((total, movimiento) => total + movimiento.cantidad, 0);