#update_column(s) skips callbacks (which is useful), but it doesn't change the updated_at field on the record by default (which we should be doing in these cases).
This change is made in Spree 2.2 here: b367c629ce
:amount is a database field in these cases, as opposed to a method that returns a computed result. Calling `.sum(:amount)` is much more efficient here as it computes the sum at database level, as opposed to `.map(&:amount).sum`, which would fetch and instanciate all the objects first, and then sum the amounts after.
DEPRECATION WARNING: `#deliver` is deprecated and will be removed in Rails 5. Use `#deliver_now` to deliver immediately or `#deliver_later` to deliver through Active Job.
OrderManagement::Stock::Packer builds a package with all the items
Failure/Error: expect(package.weight).to be_positive
expected `0.0 (#<BigDecimal:7f156c99fda8,'0.0',9(18)>).positive?` to be truthy, got false
# ./engines/order_management/spec/services/order_management/stock/packer_spec.rb:19:in `block (2 levels) in <module:Stock>'
Before when you imported products and clicked the 'Set stock to zero for all existing products not present in the file' option it would set the on hand stock to 0 but if the variant was also set to be on demand the product would still be available for sale. This change makes sure the on demand setting is turned off too.
Fixes#6064.
The #table_items methos seems to return line items in different order sometimes making this test a bit flaky. The test passed on Semaphore previously and is passing in development. I don't think the order matters so using :match_array instead of :eq.
Also add tests for each of the different report types. I didn't make these JavaScript tests because not sure that is necessary and they would be slower.
Before the date and distributor filters would have no effect. This is because the BulkCoopReport is still generated using an older style method, and isn't generated using the newer method like in the EnterpriseFeeSummaryReport. This older style report expects to receive a :q parameter but it actually received the newer style :report parameter so the filters were not being applied.
This keeps the newer style report params but converts them, after they are authorised as safe, into the older style in the controller.