This is a really good question!
Probably the most straightforward would go like this:
* Customize the StockRecord model so that there is a choices field, with two choices 'Retail' and 'Wholesale', maybe call it something like 'tier'. That's all up to you.
* Create a 'Wholesale Buyers' group or something similar
* Create a Strategy for Wholesale buyers and a Strategy for Retail buyers
* Override apps.partner.strategy.Selector to return the correct strategy based on group membership.
Here's an outline of how I might handle that: (Haven't done any testing at all; this is just for illustrative purposes.)
# apps.partner.models
class StockRecord(AbstractStockRecord):
RETAIL, WHOLESALE = 'retail', 'wholesale'
PRICING_TIER_CHOICES = (
(RETAIL, 'Retail'),
(WHOLESALE, 'Wholesale),
)
pricing_tier = models.CharField(max_length=9, choices=PRICING_TIER_CHOICES)
# apps.partner.strategy
class UseTieredStockRecord(object):
def select_stockrecord(self, product):
try:
return product.stockrecords.filter(tier=self.tier)[0]
except IndexError:
return None
class RetailUK(UseTieredStockRecord, StockRequired, FixedRateTax, Structured):
tier = StockRecord.RETAIL
rate = D('0.20')
class WholesaleUK(UseTieredStockRecord, StockRequired, FixedRateTax, Structured):
tier = StockRecord.WHOLESALE
rate = D('0.20')
class Selector(object):
def strategy(self, request=None, user=None, **kwargs):
if user and user.groups.filter(name='Wholesale Buyers').exists():
return WholesaleUK(request)
return RetailUK(request)
You might want to read some of the docs here as well:
http://django-oscar.readthedocs.org/en/latest/topics/prices_and_availability.html
https://django-oscar.readthedocs.org/en/releases-0.1/recipes/how_to_override_a_core_class.html
http://django-oscar.readthedocs.org/en/latest/howto/how_to_customise_models.html
Let me know if you have any questions.