only allow to add articles not already present in receive
This commit is contained in:
parent
beabe22a01
commit
2d99141229
2 changed files with 21 additions and 6 deletions
|
|
@ -1,8 +1,11 @@
|
|||
# :encoding:utf-8:
|
||||
module Finance::ReceiveHelper
|
||||
# TODO currently duplicate a bit of DeliveriesHelper.articles_for_select2
|
||||
def articles_for_select2(supplier)
|
||||
supplier.articles.undeleted.reorder('articles.name ASC').map do |a|
|
||||
# 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|
|
||||
{:id => a.id, :text => "#{a.name} (#{a.unit_quantity}⨯#{a.unit})"}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue