Try to assign configured store when making new purchase batch
so the UI logic doesn't need to do anything special for that
This commit is contained in:
parent
344edad06c
commit
76446d801f
|
@ -63,6 +63,22 @@ class PurchaseBatchHandler(BatchHandler):
|
||||||
return self.config.getbool('rattail.batch', 'purchase.allow_expired_credits',
|
return self.config.getbool('rattail.batch', 'purchase.allow_expired_credits',
|
||||||
default=True)
|
default=True)
|
||||||
|
|
||||||
|
def make_basic_batch(self, session, **kwargs):
|
||||||
|
"""
|
||||||
|
Create a "bare minimum" batch object.
|
||||||
|
|
||||||
|
Here we'll set the default store, if none is provided.
|
||||||
|
"""
|
||||||
|
# try to assign store for new batch
|
||||||
|
if 'store_uuid' not in kwargs and 'store' not in kwargs:
|
||||||
|
store = self.config.get_store(session)
|
||||||
|
if store:
|
||||||
|
kwargs['store'] = store
|
||||||
|
|
||||||
|
# continue with usual logic
|
||||||
|
batch = super(PurchaseBatchHandler, self).make_basic_batch(session, **kwargs)
|
||||||
|
return batch
|
||||||
|
|
||||||
def should_populate(self, batch):
|
def should_populate(self, batch):
|
||||||
# TODO: this probably should change soon, for now this works..
|
# TODO: this probably should change soon, for now this works..
|
||||||
return batch.purchase and batch.mode in (self.enum.PURCHASE_BATCH_MODE_RECEIVING,
|
return batch.purchase and batch.mode in (self.enum.PURCHASE_BATCH_MODE_RECEIVING,
|
||||||
|
|
Loading…
Reference in a new issue