Skip to content
Browse files

Fixed issue with delegating max_purchase_quantity to wrapper

  • Loading branch information...
1 parent 7ac85a5 commit 5ee416584262c9b2c063c920926fb5fdac769e72 @codeinthehole codeinthehole committed
Showing with 7 additions and 2 deletions.
  1. +4 −2 oscar/apps/partner/abstract_models.py
  2. +3 −0 oscar/apps/partner/tests/models.py
View
6 oscar/apps/partner/abstract_models.py
@@ -202,11 +202,13 @@ def availability(self):
"""
return get_partner_wrapper(self.partner.name).availability(self)
- def max_purchase_quantity(self, user):
+ def max_purchase_quantity(self, user=None):
"""
Return an item's availability as a string
+
+ :param user: (optional) The user who wants to purchase
"""
- return get_partner_wrapper(self.partner.name).availability(self)
+ return get_partner_wrapper(self.partner.name).max_purchase_quantity(self, user)
@property
def dispatch_date(self):
View
3 oscar/apps/partner/tests/models.py
@@ -58,6 +58,9 @@ def test_cancelling_allocation_ignores_too_big_allocations(self):
self.assertEqual(0, self.stockrecord.num_allocated)
self.assertEqual(10, self.stockrecord.num_in_stock)
+ def test_max_purchase_quantity(self):
+ self.assertEqual(10, self.stockrecord.max_purchase_quantity())
+
class DefaultWrapperTests(TestCase):

0 comments on commit 5ee4165

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