瀏覽代碼

Pass child to availability_policy instead of parent because it has all the data

master
Lars van de Kerkhof 6 年之前
父節點
當前提交
2e80068166
共有 2 個文件被更改,包括 4 次插入1 次删除
  1. 3
    0
      docs/source/releases/v2.1.rst
  2. 1
    1
      src/oscar/apps/partner/strategy.py

+ 3
- 0
docs/source/releases/v2.1.rst 查看文件

42
   an order (instead of raising an exception), for consistency with how
42
   an order (instead of raising an exception), for consistency with how
43
   the basket flows handle inactive vouchers.
43
   the basket flows handle inactive vouchers.
44
 
44
 
45
+- Fixed the logic of ``StockRequired.parent_availability_policy`` to use
46
+  child products to determine availability of children, rather than the parent.
47
+
45
 
48
 
46
 Dependency changes
49
 Dependency changes
47
 ~~~~~~~~~~~~~~~~~~
50
 ~~~~~~~~~~~~~~~~~~

+ 1
- 1
src/oscar/apps/partner/strategy.py 查看文件

220
     def parent_availability_policy(self, product, children_stock):
220
     def parent_availability_policy(self, product, children_stock):
221
         # A parent product is available if one of its children is
221
         # A parent product is available if one of its children is
222
         for child, stockrecord in children_stock:
222
         for child, stockrecord in children_stock:
223
-            policy = self.availability_policy(product, stockrecord)
223
+            policy = self.availability_policy(child, stockrecord)
224
             if policy.is_available_to_buy:
224
             if policy.is_available_to_buy:
225
                 return Available()
225
                 return Available()
226
         return Unavailable()
226
         return Unavailable()

Loading…
取消
儲存