mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-19 00:27:25 +00:00
Remove validation of positive stock when on demand
We weren't allowing negative stock to stop any bug from accidentally drawing too much stock. But now we want to implement a backordering logic that depends on negative stock levels to know how much is needed to replenish stock levels.
This commit is contained in:
committed by
zanetagebka
parent
29adbcb479
commit
36e6d96e17
@@ -15,7 +15,9 @@ class VariantOverride < ApplicationRecord
|
||||
# Need to ensure this can be set by the user.
|
||||
validates :default_stock, numericality: { greater_than_or_equal_to: 0 }, allow_nil: true
|
||||
validates :price, numericality: { greater_than_or_equal_to: 0 }, allow_nil: true
|
||||
validates :count_on_hand, numericality: { greater_than_or_equal_to: 0 }, allow_nil: true
|
||||
validates :count_on_hand, numericality: {
|
||||
greater_than_or_equal_to: 0, unless: :on_demand?
|
||||
}, allow_nil: true
|
||||
|
||||
default_scope { where(permission_revoked_at: nil) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user