|
@@ -17,6 +17,8 @@ Overview
|
17
|
17
|
|
18
|
18
|
Oscar now has a demo site customised for the US!
|
19
|
19
|
|
|
20
|
+Shipping methods got a thorough re-working.
|
|
21
|
+
|
20
|
22
|
Lots of methods deprecated in the 0.6 release have now been removed.
|
21
|
23
|
Specifically, the partner "wrapper" functionality is now gone. All price and
|
22
|
24
|
availability logic now needs to be handled with strategies.
|
|
@@ -50,30 +52,17 @@ Customisation just got easier!
|
50
|
52
|
* The documentation around :doc:`/topics/customisation` has been given an
|
51
|
53
|
overhaul to incorporate the changes.
|
52
|
54
|
|
53
|
|
-US demo site
|
54
|
|
-------------
|
|
55
|
+Reworked shipping app
|
|
56
|
+---------------------
|
55
|
57
|
|
56
|
|
-To help developers building sites for the US, a new example Oscar site has been
|
57
|
|
-included in the repo. This customises core Oscar to treat all prices as
|
58
|
|
-excluding tax and then calculate and apply taxes once the shipping address is
|
59
|
|
-known.
|
|
58
|
+Several parts of the shipping app have been changed. The most important is a
|
|
59
|
+change to the API of shipping methods to avoid a potential thread safety issue.
|
60
|
60
|
|
61
|
|
-See :ref:`us_site` for more information.
|
62
|
|
-
|
63
|
|
-Cleanup around shipping methods
|
64
|
|
--------------------------------
|
|
61
|
+Other changes to the shipping app include:
|
65
|
62
|
|
66
|
|
-* The models of the shipping app now have abstract base classes, similar to
|
|
63
|
+* All shipping models now have abstract base classes, similar to
|
67
|
64
|
the rest of Oscar.
|
68
|
65
|
|
69
|
|
-* The legacy ``ShippingMethod`` name of the interface of the shipping app has
|
70
|
|
- been removed. Inherit from ``shipping.base.Base`` for the class instead, and
|
71
|
|
- inherit from ``shipping.abstract_models.AbstractBase`` for model-based
|
72
|
|
- shipping methods.
|
73
|
|
-
|
74
|
|
-* ``oscar.apps.shipping.Scales`` has been renamed and moved to
|
75
|
|
- ``oscar.apps.shipping.scales.Scale``, and is now overridable.
|
76
|
|
-
|
77
|
66
|
* ``WeightBand.upper_limit`` is now a ``DecimalField``, just like the other
|
78
|
67
|
weight-related fields.
|
79
|
68
|
|
|
@@ -81,6 +70,22 @@ Cleanup around shipping methods
|
81
|
70
|
made slightly more useful. Contributions for a dedicated dashboard app are
|
82
|
71
|
most welcome!
|
83
|
72
|
|
|
73
|
+See the
|
|
74
|
+:ref:`backwards incompatible changes <incompatible_shipping_changes_in_0.8>`
|
|
75
|
+for the shipping app and the
|
|
76
|
+:doc:`guide to configuring shipping </howto/how_to_configure_shipping>`
|
|
77
|
+for more information.
|
|
78
|
+
|
|
79
|
+US demo site
|
|
80
|
+------------
|
|
81
|
+
|
|
82
|
+To help developers building sites for the US, a new example Oscar site has been
|
|
83
|
+included in the repo. This customises core Oscar to treat all prices as
|
|
84
|
+excluding tax and then calculate and apply taxes once the shipping address is
|
|
85
|
+known.
|
|
86
|
+
|
|
87
|
+See :ref:`us_site` for more information.
|
|
88
|
+
|
84
|
89
|
.. _minor_changes_in_0.8:
|
85
|
90
|
|
86
|
91
|
Minor changes
|
|
@@ -117,6 +122,68 @@ Bugfixes
|
117
|
122
|
Backwards incompatible changes in 0.8
|
118
|
123
|
=====================================
|
119
|
124
|
|
|
125
|
+.. _incompatible_shipping_changes_in_0.8:
|
|
126
|
+
|
|
127
|
+Shipping app
|
|
128
|
+------------
|
|
129
|
+
|
|
130
|
+The shipping method API has been altered to avoid potential thread-safety
|
|
131
|
+issues. Prior to v0.8, shipping methods had a ``set_basket`` method which
|
|
132
|
+allowed a basket instance to be assigned to the method. This was really a
|
|
133
|
+crutch to allow templates to have easy access to shipping charges. However, it
|
|
134
|
+was also a design problem as shipping methods could be instantiated at
|
|
135
|
+compile-time leading to a thread safety issue where multiple threads could
|
|
136
|
+assign a basket to the same shipping method instance.
|
|
137
|
+
|
|
138
|
+In Oscar 0.8, shipping methods are stateless services that have a method
|
|
139
|
+:func:`~oscar.apps.shipping.methods.Base.calculate` that takes a basket and
|
|
140
|
+returns a ``Price`` instance. New template tags are provided that allow these
|
|
141
|
+shipping charges to be accessed from templates.
|
|
142
|
+
|
|
143
|
+This API change does require quite a few changes as both the shipping method
|
|
144
|
+and shipping charge now need to be passed around separately:
|
|
145
|
+
|
|
146
|
+* The :class:`~oscar.apps.order.utils.OrderCreator` class now requires the
|
|
147
|
+ ``shipping_charge`` to be passed to ``place_order``.
|
|
148
|
+
|
|
149
|
+* The :class:`~oscar.apps.order.utils.OrderCreator` class no longer defaults to
|
|
150
|
+ free shipping: a shipping method and charge has to be explicitly passed in.
|
|
151
|
+
|
|
152
|
+* The signature of the :class:`~oscar.apps.checkout.calculators.OrderTotalCalculator`
|
|
153
|
+ class has changed to accept the shipping charge rather than a shipping
|
|
154
|
+ method instance.
|
|
155
|
+
|
|
156
|
+* The signature of the
|
|
157
|
+ :func:`~oscar.apps.checkout.session.CheckoutSessionMixin.get_order_totals`
|
|
158
|
+ method has changed to accept the shipping charge rather than a shipping
|
|
159
|
+ method instance.
|
|
160
|
+
|
|
161
|
+Other potentially breaking changes to the shipping app:
|
|
162
|
+
|
|
163
|
+* Shipping methods no longer have ``charge_excl_tax``,
|
|
164
|
+ ``charge_incl_tax`` and ``is_tax_known`` properties.
|
|
165
|
+
|
|
166
|
+* The ``Base`` shipping method class now lives in
|
|
167
|
+ ``oscar.apps.shipping.methods``.
|
|
168
|
+
|
|
169
|
+* The ``find_by_code`` method of the shipping ``Repository`` class has been
|
|
170
|
+ removed as it is no longer used.
|
|
171
|
+
|
|
172
|
+* The parameters for
|
|
173
|
+ :func:`oscar.apps.shipping.respository.Repository.get_shipping_methods`
|
|
174
|
+ have been re-ordered to reflect which are the most important.
|
|
175
|
+
|
|
176
|
+* The legacy ``ShippingMethod`` name of the interface of the shipping app has
|
|
177
|
+ been removed. Inherit from ``shipping.base.Base`` for the class instead, and
|
|
178
|
+ inherit from ``shipping.abstract_models.AbstractBase`` for model-based
|
|
179
|
+ shipping methods.
|
|
180
|
+
|
|
181
|
+* ``oscar.apps.shipping.Scales`` has been renamed and moved to
|
|
182
|
+ ``oscar.apps.shipping.scales.Scale``, and is now overridable.
|
|
183
|
+
|
|
184
|
+Misc
|
|
185
|
+----
|
|
186
|
+
|
120
|
187
|
* The ``shipping`` app saw a few renames; please see the section above.
|
121
|
188
|
* The ``oscar_calculate_scores`` command has been `rewritten`_ to use the ORM
|
122
|
189
|
instead of raw SQL. That exposed a bug in the previous calculations,
|