2013-11-25 13:48:54 +01:00
|
|
|
|
# :encoding:utf-8:
|
|
|
|
|
module Finance::ReceiveHelper
|
|
|
|
|
# TODO currently duplicate a bit of DeliveriesHelper.articles_for_select2
|
2013-11-26 13:31:07 +01:00
|
|
|
|
# except is an array of article id's to omit
|
|
|
|
|
def articles_for_select2(supplier, except = [])
|
|
|
|
|
articles = supplier.articles.reorder('articles.name ASC')
|
|
|
|
|
articles.reject! {|a| not except.index(a.id).nil? } if except
|
|
|
|
|
articles.map do |a|
|
2013-11-25 13:48:54 +01:00
|
|
|
|
{:id => a.id, :text => "#{a.name} (#{a.unit_quantity}⨯#{a.unit})"}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|