Skip to content
This repository
Browse code

Fixed issue with delegating max_purchase_quantity to wrapper

  • Loading branch information...
commit 5ee416584262c9b2c063c920926fb5fdac769e72 1 parent 7ac85a5
David Winterbottom authored June 14, 2012
6  oscar/apps/partner/abstract_models.py
@@ -202,11 +202,13 @@ def availability(self):
202 202
         """
203 203
         return get_partner_wrapper(self.partner.name).availability(self)
204 204
 
205  
-    def max_purchase_quantity(self, user):
  205
+    def max_purchase_quantity(self, user=None):
206 206
         """
207 207
         Return an item's availability as a string
  208
+
  209
+        :param user: (optional) The user who wants to purchase
208 210
         """
209  
-        return get_partner_wrapper(self.partner.name).availability(self)
  211
+        return get_partner_wrapper(self.partner.name).max_purchase_quantity(self, user)
210 212
     
211 213
     @property
212 214
     def dispatch_date(self):
3  oscar/apps/partner/tests/models.py
@@ -58,6 +58,9 @@ def test_cancelling_allocation_ignores_too_big_allocations(self):
58 58
         self.assertEqual(0, self.stockrecord.num_allocated)
59 59
         self.assertEqual(10, self.stockrecord.num_in_stock)
60 60
 
  61
+    def test_max_purchase_quantity(self):
  62
+        self.assertEqual(10, self.stockrecord.max_purchase_quantity())
  63
+
61 64
 
62 65
 class DefaultWrapperTests(TestCase):
63 66
 

0 notes on commit 5ee4165

Please sign in to comment.
Something went wrong with that request. Please try again.