Ok, that was actually very easy.  Here is a pull request:
https://bitbucket.org/stephenmcd/cartridge/pull-request/25/update-order-to-inherit-from-siterelated/diff

The changes are:

   - Order now inherits from SiteRelated (I added a migration to make the
   update)
   - A new setting, SHOP_ORDERS_PER_SITE (default False to maintain the
   current functionality) toggles whether OrderManager inherits from
   CurrentSiteManager effectively turning on/off the Site handling used
   throughout the rest of Mezzanine for Order

Rationale for putting this in Cartridge rather than trying to get it to
work externally:

   - It's cleaner/DRYer to have Order inherit from SiteRelated rather than
   adding a site field with EXTRA_MODEL_FIELDS
   - Almost everything else in Mezzanine inherits from SiteRelated so it is
   more consistent to have Order follow this pattern
   - Even if SHOP_ORDER_PER_SITE is left False (essentially the way things
   currently are) it's useful to know what site a particular order is tied
   too.  As of now it could be difficult to figure out which site a particular
   Order was from especially if the SKU that was purchased no longer exists.



On Wed, May 28, 2014 at 10:09 AM, Josh Cartmell <[email protected]>wrote:

> Yeah I defintiely see that there could be a use case for that.  In my case
> it was a bit confusing because almost everything else in
> Mezzanine/Cartridge inherits from SiteRelated in some way.  I had just
> expected Order to and near the end of the project while I was working on
> some reports realized it didn't.
>
> What about if Order did inherit from SiteRelated but we introduce a new
> setting that toggles whether orders are global or tied to a particular
> site?  Then we can change the manager for Order depending on the value of
> that setting.  The default could be that they are global.  Even with global
> orders I think site related would be useful because it would allow someone
> to write reports that break down sales by which site they came through.
>
> I'm going to work on that so I can at least make use of it in my case.
>
>
> On Tue, May 27, 2014 at 5:48 PM, Stephen McDonald <[email protected]> wrote:
>
>> Hard to answer. I imagine in some cases it'd be more desirable for orders
>> to be global.
>>
>> Eg a business with one admin, one set of user accounts and many sites,
>> would only want one interface to all orders.
>>
>>
>> On Wed, May 28, 2014 at 1:57 AM, Josh Cartmell <[email protected]>wrote:
>>
>>> I'm working on a Mezzanine/Cartridge site which will have multi
>>> tenancy.  I'm writing some custom management commands that should be able
>>> to filter Orders on a per site basis.  I just noticed that Order is not
>>> SiteRelated so at least as things stand I won't be able to do that.
>>>
>>> Should Order inherit from SiteRelated?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Stephen McDonald
>> http://jupo.org
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to