Version 1.3.0
Solidus Core Team
22 Jun 2016 - 9 mins read
Introducing Solidus 1.3.0, the "international" release
This release introduces major changes intended to better support VAT taxation and per-country pricing. Martin's SolidusConf 2016 talk gives an introduction to these changes and their motivation. A blog post focusing on upgrading is to come.
This release includes 1075 commits from 39 different authors. Thanks to everyone who contributed, tested, or provided feedback for this release.
Changelog
-
Order now requires a
store_id
in validationsAll orders created since Spree v2.4 should have a store assigned. A migration exists to assign all orders without a store to the default store.
If you are seeing spec failures related to this, you may have to add
let!(:store) { create(:store) }
to some test cases. -
Deprecate
Spree::TaxRate.adjust
, removeSpree::TaxRate.match
The functionality of
Spree::TaxRate.adjust
is now contained in the newSpree::Tax::OrderAdjuster
class.Wherever you called
Spree::TaxRate.adjust(items, order_tax_zone)
, instead callSpree::Tax::OrderAdjuster.new(order).adjust!
.Spree::TaxRate.match
was an implementation detail ofSpree::TaxRate.adjust
. It has been removed, and its functionality is now contained in the private methodSpree::Tax::TaxHelpers#applicable_rates(order)
. -
Allow more options than
current_currency
to select pricesPreviously, availability of products/variants, caching and pricing was dependent only on a
current_currency
string. This has been changed to acurrent_pricing_options
object. For now, this object (Spree::Variant::PricingOptions
) only holds the currency. It is used for caching instead of the deprecatedcurrent_currency
helper.Additionally, your pricing can be customized using a
VariantPriceSelector
object, a default implementation of which can be found inSpree::Variant::PriceSelector
. It is responsible for finding the right price for variant, be it for front-end display or for adding it to the cart. You can set it through the newSpree::Config.variant_price_selector_class
setting. This class also knows whichPricingOptions
class it cooperates with.Deprecated methods:
current_currency
helperSpree::Variant#categorise_variants_from_option
Spree::Variant#variants_and_option_values
(UseSpree::Variant#variants_and_option_values#for
instead)Spree::Core::Search::Base#current_currency
Spree::Core::Search::Base#current_currency=
Extracted Functionality:
There was a strange way of setting prices for line items depending on additional attributes being present on the line item (
gift_wrap: true
, for example). It also neededSpree::Variant
to be patched with methods likeSpree::Variant#gift_wrap_price_modifier_in
and is generally deemed a non-preferred way of modifying pricing. This functionality has now been moved into a Gem of its own to ease the transition to the newVariant::PriceSelector
system. -
Respect
Spree::Store#default_currency
Previously, the
current_currency
helper in both thecore
andapi
gems would always return the globally configured default currency rather than the current store's one. With Solidus 1.3, we respect that setting without having to install thespree_multi_domain
extension. -
Persist tax estimations on shipping rates
Previously, shipping rate taxes were calculated on the fly every time a shipping rate would be displayed. Now, shipping rate taxes are stored on a dedicated table to look up.
There is a new model Spree::ShippingRateTax where the taxes are stored, and a new Spree::Tax::ShippingRateTaxer that builds those taxes from within Spree::Stock::Estimator.
The shipping rate taxer class can be exchanged for a custom estimator class using the new Spree::Appconfiguration.shipping_rate_taxer_class preference.
https://github.com/solidusio/solidus/pull/904
In order to convert your historical shipping rate taxation data, please run
rake solidus:upgrade:one_point_three
- this will create persisted taxation notes for historical shipping rates. Be aware though that these taxation notes are estimations and should not be used for accounting purposes.https://github.com/solidusio/solidus/pull/1068
-
Deprecate setting a line item's currency by hand
Previously, a line item's currency could be set directly, and differently from the line item's order's currency. This would result in an error. It still does, but is also now explicitly deprecated. In the future, we might delete the line item's
currency
column and just delegate to the line item's order. -
Taxes for carts now configurable via the
Spree::Store
objectIn VAT countries, carts (orders without addresses) have to be shown with adjustments for the country whose taxes the cart's prices supposedly include. This might differ from
Spree::Store
toSpree::Store
. We're introducting thecart_tax_country_iso
setting on Spree::Store for this purpose.Previously the setting for what country any prices include Spree::Zone.default_tax. That, however, would also implicitly tag all prices in Spree as including the taxes from that zone. Introducing the cart tax setting on Spree::Store relieves that boolean of some of its responsibilities.
https://github.com/solidusio/solidus/pull/933
-
Make Spree::Product#prices association return all prices
Previously, only non-master variant prices would have been returned here. Now, we get all the prices, including those from the master variant.
https://github.com/solidusio/solidus/pull/969
-
Changes to Spree::Stock::Estimator
- The package passed to Spree::Stock::Estimator#shipping_rates must have its shipment assigned and that shipment must have its order assigned. This is needed for some upcoming tax work in to calculate taxes correctly.
- Spree::Stock::Estimator.new no longer accepts an order argument. The order will be fetched from the shipment.
https://github.com/solidusio/solidus/pull/965
-
Removed Spree::Stock::Coordinator#packages from the public interface.
This will allow us to refactor more easily. https://github.com/solidusio/solidus/pull/950
-
Removed
pre_tax_amount
column from line item and shipment tablesThis column was previously used as a caching column in the process of calculating VATs. Its value should have been (but wasn't) always the same as
discounted_amount - included_tax_total
. It's been replaced with a method that does just that. #941 -
Renamed return item
pre_tax_amount
column toamount
The naming and functioning of this column was inconsistent with how shipments and line items work: In those models, the base from which we calculate everything is the
amount
. The ReturnItem now works just like a line item.Usability-wise, this change entails that for VAT countries, when creating a refund for an order including VAT, you now have to enter the amount you want to refund including VAT. This is what a backend user working with prices including tax would expect.
For a non-VAT store, nothing changes except for the form field name, which now says
Amount
instead ofPre-tax-amount
. You might want to adjust the i18n translation here, depending on your circumstances. #706 -
Removed Spree::BaseHelper#gem_available? and Spree::BaseHelper#current_spree_page?
Both these methods were untested and not appropriate code to be in core. If you need these methods please pull them into your app. #710.
-
Fixed a bug where toggling 'show only complete order' on/off was not showing all orders. #749
-
ffaker has been updated to version 2.x
This version changes the namespace from Faker:: to FFaker::
-
versioncake has been updated to version 3.x
This version uses a rack middleware to determine the version, uses a different header name, and has some configuration changes.
You probably need to add this to your controller specs.
More information is available in the VersionCake README
-
Bootstrap 4.0.0-alpha.2 is included into the admin.
-
Pagination now uses an admin-specific kaminari theme, which uses the bootstrap4 styles. If you have a custom admin page with pagination you can use this style with the following.
<%= paginate @collection, theme: "solidus_admin" %>
-
Settings configuration menu has been replaced with groups of tabs at the top
- Settings pages were grouped into related partials as outlined in #634
- Partials are rendered on pages owned by the partials as tabs as a top bar
- Admin-nav has a sub-menu for the settings now
-
Lists of classes in configuration (
config.spree.calculators
,spree.spree.calculators
, etc.) are now stored internally as strings and constantized when accessed. This allows these classes to be reloaded in development mode and loaded later in the boot process. #1203