2009-02-12 18:32:20 +01:00
|
|
|
class StockTakingsController < ApplicationController
|
2011-05-27 14:09:01 +02:00
|
|
|
inherit_resources
|
2009-02-12 18:32:20 +01:00
|
|
|
|
2012-10-29 18:28:17 +01:00
|
|
|
def index
|
|
|
|
@stock_takings = StockTaking.order('date DESC').page(params[:page]).per(@per_page)
|
|
|
|
end
|
|
|
|
|
2009-02-12 18:32:20 +01:00
|
|
|
def new
|
|
|
|
@stock_taking = StockTaking.new
|
2023-05-12 13:01:12 +02:00
|
|
|
StockArticle.undeleted.each { |a| @stock_taking.stock_changes.build(stock_article: a) }
|
2009-02-12 18:32:20 +01:00
|
|
|
end
|
|
|
|
|
2019-05-14 16:24:41 +02:00
|
|
|
def new_on_stock_article_create # See publish/subscribe design pattern in /doc.
|
|
|
|
stock_article = StockArticle.find(params[:stock_article_id])
|
2023-05-12 13:01:12 +02:00
|
|
|
@stock_change = StockChange.new(stock_article: stock_article)
|
2019-05-14 16:24:41 +02:00
|
|
|
|
2023-05-12 13:01:12 +02:00
|
|
|
render layout: false
|
2019-05-14 16:24:41 +02:00
|
|
|
end
|
|
|
|
|
2009-02-12 18:32:20 +01:00
|
|
|
def create
|
2023-05-12 13:01:12 +02:00
|
|
|
create!(notice: I18n.t('stock_takings.create.notice'))
|
2009-02-12 18:32:20 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2023-05-12 13:01:12 +02:00
|
|
|
update!(notice: I18n.t('stock_takings.update.notice'))
|
2009-02-12 18:32:20 +01:00
|
|
|
end
|
|
|
|
end
|