Merge pull request #13310 from mkllnk/reset-products

Fix product reset on import
This commit is contained in:
Konrad
2025-05-16 18:49:20 +02:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@@ -37,8 +37,10 @@ module Catalog
def reset_variant_on_hand_and_on_demand(variant)
was_on_demand = variant.on_demand
variant.on_demand = false
# Reset on_hand value first because a negative level wouldn't be valid
# with on_demand being false.
variant.on_hand = 0
variant.on_demand = false
variant.on_hand.zero? || was_on_demand
end
end

View File

@@ -240,8 +240,6 @@ RSpec.describe "Product Import" do
end
it "can reset product stock to zero for products not present in the CSV" do
pending("#12933")
csv_data = <<~CSV
name, producer, category, on_hand, price, units, unit_type, shipping_category_id
Carrots, User Enterprise, Vegetables, 500, 3.20, 500, g, #{shipping_category_id_str}