mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Assign supplier_id when saving new product to products list
This commit is contained in:
@@ -166,6 +166,7 @@ module ProductImport
|
||||
|
||||
product = Spree::Product.new
|
||||
product.assign_attributes(entry.attributes.except('id'))
|
||||
product.supplier_id = entry.enterprise_id
|
||||
assign_defaults(product, entry)
|
||||
|
||||
if product.save
|
||||
|
||||
@@ -207,6 +207,7 @@ module ProductImport
|
||||
def mark_as_new_product(entry)
|
||||
new_product = Spree::Product.new
|
||||
new_product.assign_attributes(entry.attributes.except('id'))
|
||||
new_product.supplier_id = entry.enterprise_id
|
||||
|
||||
if new_product.valid?
|
||||
entry.validates_as = 'new_product' unless entry.errors?
|
||||
|
||||
Reference in New Issue
Block a user