Stock/EventListener/StockAdjustmentListener.php
public function onInsert(ResourceEventInterface $event)
    {
        $stockAdjustment = $this->getStockAdjustmentFromEvent($event);

        if (null === $stockUnit = $stockAdjustment->getStockUnit()) {
            throw new RuntimeException("Stock unit must be set at this point.");
        }

        $quantity = StockAdjustmentReasons::isDebitReason($stockAdjustment->getReason())
            ? -$stockAdjustment->getQuantity()
            : $stockAdjustment->getQuantity();

        $this->stockUnitUpdater->updateAdjusted($stockUnit, $quantity, true);
    }
public function onInsert(ResourceEventInterface $event)
    {
        $stockAdjustment = $this->getStockAdjustmentFromEvent($event);

        if (null === $stockUnit = $stockAdjustment->getStockUnit()) {
            throw new RuntimeException("Stock unit must be set at this point.");
        }

        $quantity = StockAdjustmentReasons::isDebitReason($stockAdjustment->getReason())
            ? -$stockAdjustment->getQuantity()
            : $stockAdjustment->getQuantity();

        $this->stockUnitUpdater->updateAdjusted($stockUnit, $quantity, true);
    }
Insert event handler.

@param ResourceEventInterface $event