Sha256: d23033a12416b4868d4c098e0423e277b13f298b491cb438aef4b0d94f814f63

Contents?: true

Size: 1.06 KB

Versions: 88

Compression:

Stored size: 1.06 KB

Contents

module Spree
  module Admin
    class StockMovementsController < Spree::Admin::BaseController
      respond_to :html
      helper_method :stock_location

      def index
        @stock_movements = stock_location.stock_movements.recent.
          includes(:stock_item => { :variant => :product }).
          page(params[:page])
      end

      def new
        @stock_movement = stock_location.stock_movements.build
      end

      def create
        @stock_movement = stock_location.stock_movements.build(stock_movement_params)
        @stock_movement.save
        flash[:success] = flash_message_for(@stock_movement, :successfully_created)
        redirect_to admin_stock_location_stock_movements_path(stock_location)
      end

      def edit
        @stock_movement = StockMovement.find(params[:id])
      end

      private

      def stock_location
        @stock_location ||= StockLocation.find(params[:stock_location_id])
      end

      def stock_movement_params
        params.require(:stock_movement).permit(:quantity, :stock_item_id, :action)
      end
    end
  end
end

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
spree_backend-3.1.14 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.13 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.12 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.11 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.10 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.9 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.8 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.7 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.6 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.5 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.4 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.3 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.2 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.0.10 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.1 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.0 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.0.rc4 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.0.9 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.0.rc3 app/controllers/spree/admin/stock_movements_controller.rb
spree_backend-3.1.0.rc2 app/controllers/spree/admin/stock_movements_controller.rb