On #779 Use new received
state for 'Receive' button in orders index
This slightly increases the performance as the associated order_articles no longer need to be fetched.
This commit is contained in:
parent
a96dbd563b
commit
e3c720589d
1 changed files with 1 additions and 2 deletions
|
@ -151,8 +151,7 @@ module OrdersHelper
|
||||||
if order.stockit?
|
if order.stockit?
|
||||||
content_tag :div, t('orders.index.action_receive'), class: "btn disabled #{options[:class]}"
|
content_tag :div, t('orders.index.action_receive'), class: "btn disabled #{options[:class]}"
|
||||||
else
|
else
|
||||||
was_received = order.order_articles.where('units_received IS NOT NULL').any?
|
link_to t('orders.index.action_receive'), receive_order_path(order), class: "btn#{' btn-success' unless order.received?} #{options[:class]}"
|
||||||
link_to t('orders.index.action_receive'), receive_order_path(order), class: "btn#{' btn-success' unless was_received} #{options[:class]}"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue