adjustStock method
Adjust stock
Implementation
Future<StockMovement> adjustStock(StockAdjustmentRequest request) async {
state = const AsyncValue.loading();
try {
final client = ref.read(prodobitClientProvider);
final movement = await client.inventory.adjustStock(request);
// Refresh related providers
ref
..invalidate(itemStockProvider(request.itemId))
..invalidate(locationStockProvider(request.locationId))
..invalidate(stockMovementsProvider)
..invalidate(lowStockItemsProvider);
state = const AsyncValue.data(null);
return movement;
} catch (e, stack) {
state = AsyncValue.error(e, stack);
rethrow;
}
}