Make StockEvent a base class for Delivery and StockTaking

This helps to share code between the two entities and allows easier
extensions in the future.
This commit is contained in:
Patrick Gansterer 2020-08-01 20:11:25 +02:00
parent a5582e9542
commit 785313ac23
9 changed files with 69 additions and 33 deletions

View file

@ -6,15 +6,15 @@ module StockitHelper
end
def link_to_stock_change_reason(stock_change)
if stock_change.delivery_id
if stock_change.delivery
link_to Delivery.model_name.human, supplier_delivery_path(stock_change.delivery.supplier, stock_change.delivery)
elsif stock_change.order_id
elsif stock_change.order
link_to Order.model_name.human, order_path(stock_change.order)
elsif stock_change.stock_taking_id
elsif stock_change.stock_taking
link_to StockTaking.model_name.human, stock_taking_path(stock_change.stock_taking)
end
end
def stock_article_price_hint(stock_article)
t('simple_form.hints.stock_article.edit_stock_article.price',
:stock_article_copy_link => link_to(t('stockit.form.copy_stock_article'),