mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
12973: fix error raised in variant creation
- if the sheet doesn't have the units present, then the variant is not saved due to model validation - After that, while assigning on_hand value, error is raised that the variant is not created first - Now this commit makes sure that the variant is created before implementing above logic
This commit is contained in:
@@ -79,10 +79,9 @@ module ProductImport
|
||||
if entry.attributes['on_hand'].present?
|
||||
new_variant.on_hand = entry.attributes['on_hand']
|
||||
end
|
||||
check_on_hand_nil(entry, new_variant)
|
||||
end
|
||||
|
||||
check_on_hand_nil(entry, new_variant)
|
||||
|
||||
if new_variant.valid?
|
||||
entry.product_object = new_variant
|
||||
entry.validates_as = 'new_variant' unless entry.errors?
|
||||
|
||||
Reference in New Issue
Block a user