|
@@ -128,8 +128,8 @@ class Structured(Base):
|
128
|
128
|
# Select children and associated stockrecords
|
129
|
129
|
children_stock = self.select_children_stockrecords(product)
|
130
|
130
|
return PurchaseInfo(
|
131
|
|
- price=self.group_pricing_policy(product, children_stock),
|
132
|
|
- availability=self.group_availability_policy(
|
|
131
|
+ price=self.parent_pricing_policy(product, children_stock),
|
|
132
|
+ availability=self.parent_availability_policy(
|
133
|
133
|
product, children_stock),
|
134
|
134
|
stockrecord=None)
|
135
|
135
|
|
|
@@ -163,10 +163,11 @@ class Structured(Base):
|
163
|
163
|
"A structured strategy class must define a "
|
164
|
164
|
"'pricing_policy' method")
|
165
|
165
|
|
166
|
|
- def group_pricing_policy(self, product, children_stock):
|
|
166
|
+ def parent_pricing_policy(self, product, children_stock):
|
167
|
167
|
raise NotImplementedError(
|
168
|
168
|
"A structured strategy class must define a "
|
169
|
|
- "'group_pricing_policy' method")
|
|
169
|
+ "'parent_pricing_policy' method")
|
|
170
|
+ group_pricing_policy = deprecated(parent_pricing_policy)
|
170
|
171
|
|
171
|
172
|
def availability_policy(self, product, stockrecord):
|
172
|
173
|
"""
|
|
@@ -176,6 +177,12 @@ class Structured(Base):
|
176
|
177
|
"A structured strategy class must define a "
|
177
|
178
|
"'availability_policy' method")
|
178
|
179
|
|
|
180
|
+ def parent_availability_policy(self, product, children_stock):
|
|
181
|
+ raise NotImplementedError(
|
|
182
|
+ "A structured strategy class must define a "
|
|
183
|
+ "'parent_availability_policy' method")
|
|
184
|
+ group_availability_policy = deprecated(parent_availability_policy)
|
|
185
|
+
|
179
|
186
|
|
180
|
187
|
# Mixins - these can be used to construct the appropriate strategy class
|
181
|
188
|
|
|
@@ -212,7 +219,7 @@ class StockRequired(object):
|
212
|
219
|
return availability.StockRequired(
|
213
|
220
|
stockrecord.net_stock_level)
|
214
|
221
|
|
215
|
|
- def group_availability_policy(self, product, children_stock):
|
|
222
|
+ def parent_availability_policy(self, product, children_stock):
|
216
|
223
|
# A parent product is available if one of its children is
|
217
|
224
|
for child, stockrecord in children_stock:
|
218
|
225
|
policy = self.availability_policy(product, stockrecord)
|
|
@@ -237,7 +244,7 @@ class NoTax(object):
|
237
|
244
|
excl_tax=stockrecord.price_excl_tax,
|
238
|
245
|
tax=D('0.00'))
|
239
|
246
|
|
240
|
|
- def group_pricing_policy(self, product, children_stock):
|
|
247
|
+ def parent_pricing_policy(self, product, children_stock):
|
241
|
248
|
stockrecords = [x[1] for x in children_stock if x[1] is not None]
|
242
|
249
|
if not stockrecords:
|
243
|
250
|
return prices.Unavailable()
|
|
@@ -268,7 +275,7 @@ class FixedRateTax(object):
|
268
|
275
|
excl_tax=stockrecord.price_excl_tax,
|
269
|
276
|
tax=tax)
|
270
|
277
|
|
271
|
|
- def group_pricing_policy(self, product, children_stock):
|
|
278
|
+ def parent_pricing_policy(self, product, children_stock):
|
272
|
279
|
stockrecords = [x[1] for x in children_stock if x[1] is not None]
|
273
|
280
|
if not stockrecords:
|
274
|
281
|
return prices.Unavailable()
|
|
@@ -297,7 +304,7 @@ class DeferredTax(object):
|
297
|
304
|
currency=stockrecord.price_currency,
|
298
|
305
|
excl_tax=stockrecord.price_excl_tax)
|
299
|
306
|
|
300
|
|
- def group_pricing_policy(self, product, children_stock):
|
|
307
|
+ def parent_pricing_policy(self, product, children_stock):
|
301
|
308
|
stockrecords = [x[1] for x in children_stock if x[1] is not None]
|
302
|
309
|
if not stockrecords:
|
303
|
310
|
return prices.Unavailable()
|