mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-23 05:28:53 +00:00
Merge pull request #13064 from mkllnk/negative-stock
Don't show stock for on-demand inventory items
This commit is contained in:
@@ -6,6 +6,12 @@ module Api
|
||||
attributes :id, :hub_id, :variant_id, :sku, :price, :count_on_hand, :on_demand,
|
||||
:default_stock, :resettable, :tag_list, :tags, :import_date
|
||||
|
||||
def count_on_hand
|
||||
return if object.on_demand
|
||||
|
||||
object.count_on_hand
|
||||
end
|
||||
|
||||
def tag_list
|
||||
object.tag_list.join(",")
|
||||
end
|
||||
|
||||
@@ -19,6 +19,7 @@ module Api
|
||||
end
|
||||
|
||||
def on_hand
|
||||
return if object.on_demand
|
||||
return 0 if object.on_hand.nil?
|
||||
|
||||
object.on_hand
|
||||
|
||||
Reference in New Issue
Block a user