A previous pull request added support for flexible decimal characters
when editing money amounts.
https://github.com/openfoodfoundation/openfoodnetwork/pull/1831
This pull request applies the same principle to the weight calculator
which was missed in the previous pull request.
The ship address of the order is properly set in
ProxyOrder#initialise_order! through OrderFactory.
The source of these spec failures seem to be a matter of how the records
are set up for the tests.
Spree made that scope default so that we don't need to define or call
it. There might be cases in which we were showing deleted variants and
now we are not, but I have not idea how to find them.
Related Spree commit:
- cd3add960e
This keeps the override of Spree's model leaner. More importantly, it
prepares us for using `destroy` instead of `delete`.
In the past, `Product#delete` soft-deleted the product, but didn't
delete the variants. When we use `Product#destroy` to soft-delete the
product, it will also call destroy on the variants. If the model doesn't
allow the deletion of the last variant, it will fail. So when a product
is deleted we want to allow the deletion of all variants. But the user
should not be allowed to delete the last variant. That's why I'm moving
the check to the controller level.
Related commits:
- e6c7acdff3
- 2b47c9145a
- b9f19d5777 (diff-412c5af2ec1ba9f6643f6df5a673c1d4R105)
Spree changed their way of soft-deleting products, variants and
some other models. `#destroy` is now soft-deleting and replaces
`#delete`.
This commit considers only products. Variants will follow in another
commit. The other models can be ignored, because we don't call `delete`
on them.
variant.on_hand will not return infinity any longer if variant.on_demand is true. Clients of these methods will have to handle the combinations between on_hand and on_demand values
* 2-0-stable: (121 commits)
Stub default value for other calls to File.exist?
Add specs for error cases in shipments_controller_spec
Move features/admin/reports/enterprise_fee_summaries_spec to xdescribe (will be fixed as part of spree upgrade phase 2)
Add missing translation to fix shipping methods spec
Test tagging polymorphism on a payment method
Workaround Rails inheritance bug in Spree::Gateway
Improve method names in shipments_controller_spec
Move ProductImporter spec to xdescribe until all its specs are green (spree upgrade phase 2)
Make bulk invoices part of spree upgrade phase 2
Make Api::ShipmentsController#create re-use order.shipment if it exists Improve code and add specs to this controller
Decorate spree api shipments controller to scope variants as they are added/removed from shipments
Delete all Spree::Admin::LineItemsController customizations as they are no longer used
Update spec/controllers/spree/orders_controller_spec.rb
Fix broken spec from refactored method
Wait for button to disappear before checking flash
Use flash matcher in shipping method feature specs
Add RSpec matchers for flash messages
Do not expect modal open when checking spinner gone
Fix layout violation in Spree::Ability decorator
Fix description for feature flag example groups
...
Due to a bug in ActiveRecord we need to load the tagging code in Gateway which
should have inherited it from its parent PaymentMethod.
We have to call it before loading the PaymentMethod decorator because the
tagging code won't load twice within the inheritance chain.
https://github.com/openfoodfoundation/openfoodnetwork/issues/3121