I think I found a bug with Inventory Unit adjustme...
# support
b
I think I found a bug with Inventory Unit adjustment cancellation 🤔 There are 2 Mario Karts in the shipment. Each got a unit cancellation in sequence. Looks like the division was applied by accident twice.
Looks like it did
36.0 / 2.0
internally.
Looks like directly after an inventory unit gets a unit cancel created, it doesn't set the inventory unit as canceled. In my code I was effectively doing:
Copy code
inventory_units.each do |inventory_unit|
  Spree::UnitCancel.create!(inventory_unit:).adjust!
end

inventory_units.cancelable.each(&:cancel!)
But the solution was:
Copy code
inventory_units.each do |inventory_unit|
  Spree::UnitCancel.create!(inventory_unit:).adjust!
  inventory_unit.cancel!
end
I wonder if we could make
Spree::UnitCancel
handle that state change itself.