mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Blank out product SKU when cloning a product
This was effectively being done before for the product's sku (stored on the master variant) via the #duplicate_variant method, but now it needs to be done explicitly on the product in #duplicate_product
(cherry picked from commit 0f253bb2a0)
This commit is contained in:
@@ -21,6 +21,7 @@ module Spree
|
||||
product.dup.tap do |new_product|
|
||||
new_product.name = "COPY OF #{product.name}"
|
||||
new_product.taxons = product.taxons
|
||||
new_product.sku = ""
|
||||
new_product.created_at = nil
|
||||
new_product.deleted_at = nil
|
||||
new_product.updated_at = nil
|
||||
|
||||
@@ -69,6 +69,7 @@ describe Spree::Core::ProductDuplicator do
|
||||
duplicator = Spree::Core::ProductDuplicator.new(product)
|
||||
expect(new_product).to receive(:name=).with("COPY OF foo")
|
||||
expect(new_product).to receive(:taxons=).with([])
|
||||
expect(new_product).to receive(:sku=).with("")
|
||||
expect(new_product).to receive(:product_properties=).with([new_property])
|
||||
expect(new_product).to receive(:created_at=).with(nil)
|
||||
expect(new_product).to receive(:unit_value=).with(true)
|
||||
|
||||
@@ -16,6 +16,7 @@ module Spree
|
||||
it 'duplicates product' do
|
||||
clone = product.duplicate
|
||||
expect(clone.name).to eq 'COPY OF ' + product.name
|
||||
expect(clone.sku).to eq ""
|
||||
expect(clone.image).to eq product.image
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user