fix: expose new order batch handler choice in orders/configure
This commit is contained in:
parent
f4fdba1bbb
commit
ac753a62f8
|
@ -49,9 +49,15 @@ sideshow_libcache = "sideshow.web.static:libcache"
|
||||||
[project.entry-points."paste.app_factory"]
|
[project.entry-points."paste.app_factory"]
|
||||||
"main" = "sideshow.web.app:main"
|
"main" = "sideshow.web.app:main"
|
||||||
|
|
||||||
|
[project.entry-points."wutta.batch.neworder"]
|
||||||
|
"sideshow" = "sideshow.batch.neworder:NewOrderBatchHandler"
|
||||||
|
|
||||||
[project.entry-points."wutta.config.extensions"]
|
[project.entry-points."wutta.config.extensions"]
|
||||||
"sideshow" = "sideshow.config:SideshowConfig"
|
"sideshow" = "sideshow.config:SideshowConfig"
|
||||||
|
|
||||||
|
[project.entry-points."wutta.web.menus"]
|
||||||
|
sideshow = "sideshow.web.menus:SideshowMenuHandler"
|
||||||
|
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "https://wuttaproject.org/"
|
Homepage = "https://wuttaproject.org/"
|
||||||
|
|
|
@ -46,8 +46,12 @@ class SideshowConfig(WuttaConfigExtension):
|
||||||
config.setdefault(f'{config.appname}.model_spec', 'sideshow.db.model')
|
config.setdefault(f'{config.appname}.model_spec', 'sideshow.db.model')
|
||||||
config.setdefault(f'{config.appname}.enum_spec', 'sideshow.enum')
|
config.setdefault(f'{config.appname}.enum_spec', 'sideshow.enum')
|
||||||
|
|
||||||
|
# batch handlers
|
||||||
|
config.setdefault(f'{config.appname}.batch.neworder.handler.default_spec',
|
||||||
|
'sideshow.batch.neworder:NewOrderBatchHandler')
|
||||||
|
|
||||||
# web app menu
|
# web app menu
|
||||||
config.setdefault(f'{config.appname}.web.menus.handler_spec',
|
config.setdefault(f'{config.appname}.web.menus.handler.default_spec',
|
||||||
'sideshow.web.menus:SideshowMenuHandler')
|
'sideshow.web.menus:SideshowMenuHandler')
|
||||||
|
|
||||||
# web app libcache
|
# web app libcache
|
||||||
|
|
|
@ -61,4 +61,32 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3 class="block is-size-3">Batches</h3>
|
||||||
|
<div class="block" style="padding-left: 2rem;">
|
||||||
|
|
||||||
|
<b-field label="New Order Batch Handler">
|
||||||
|
<input type="hidden"
|
||||||
|
name="wutta.batch.neworder.handler.spec"
|
||||||
|
:value="simpleSettings['wutta.batch.neworder.handler.spec']" />
|
||||||
|
<b-select v-model="simpleSettings['wutta.batch.neworder.handler.spec']"
|
||||||
|
@input="settingsNeedSaved = true">
|
||||||
|
<option :value="null">(use default)</option>
|
||||||
|
<option v-for="handler in batchHandlers"
|
||||||
|
:key="handler.spec"
|
||||||
|
:value="handler.spec">
|
||||||
|
{{ handler.spec }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
</div>
|
||||||
|
</%def>
|
||||||
|
|
||||||
|
<%def name="modify_vue_vars()">
|
||||||
|
${parent.modify_vue_vars()}
|
||||||
|
<script>
|
||||||
|
|
||||||
|
ThisPageData.batchHandlers = ${json.dumps(batch_handlers)|n}
|
||||||
|
|
||||||
|
</script>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
|
@ -163,7 +163,7 @@ class OrderView(MasterView):
|
||||||
Returns the configured :term:`handler` for :term:`new order
|
Returns the configured :term:`handler` for :term:`new order
|
||||||
batches <new order batch>`.
|
batches <new order batch>`.
|
||||||
|
|
||||||
You normally would not need to call this; just use
|
You normally would not need to call this, and can use
|
||||||
:attr:`batch_handler` instead.
|
:attr:`batch_handler` instead.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
|
@ -172,9 +172,7 @@ class OrderView(MasterView):
|
||||||
"""
|
"""
|
||||||
if hasattr(self, 'batch_handler'):
|
if hasattr(self, 'batch_handler'):
|
||||||
return self.batch_handler
|
return self.batch_handler
|
||||||
|
return self.app.get_batch_handler('neworder')
|
||||||
# TODO
|
|
||||||
return NewOrderBatchHandler(self.config)
|
|
||||||
|
|
||||||
def create(self):
|
def create(self):
|
||||||
"""
|
"""
|
||||||
|
@ -863,6 +861,9 @@ class OrderView(MasterView):
|
||||||
""" """
|
""" """
|
||||||
settings = [
|
settings = [
|
||||||
|
|
||||||
|
# batches
|
||||||
|
{'name': 'wutta.batch.neworder.handler.spec'},
|
||||||
|
|
||||||
# customers
|
# customers
|
||||||
{'name': 'sideshow.orders.use_local_customers',
|
{'name': 'sideshow.orders.use_local_customers',
|
||||||
# nb. this is really a bool but we present as string in config UI
|
# nb. this is really a bool but we present as string in config UI
|
||||||
|
@ -895,6 +896,10 @@ class OrderView(MasterView):
|
||||||
|
|
||||||
context['pending_product_fields'] = self.PENDING_PRODUCT_ENTRY_FIELDS
|
context['pending_product_fields'] = self.PENDING_PRODUCT_ENTRY_FIELDS
|
||||||
|
|
||||||
|
handlers = self.app.get_batch_handler_specs('neworder')
|
||||||
|
handlers = [{'spec': spec} for spec in handlers]
|
||||||
|
context['batch_handlers'] = handlers
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -42,6 +42,8 @@ class TestOrderView(WebTestCase):
|
||||||
|
|
||||||
def test_create(self):
|
def test_create(self):
|
||||||
self.pyramid_config.include('sideshow.web.views')
|
self.pyramid_config.include('sideshow.web.views')
|
||||||
|
self.config.setdefault('wutta.batch.neworder.handler.spec',
|
||||||
|
'sideshow.batch.neworder:NewOrderBatchHandler')
|
||||||
model = self.app.model
|
model = self.app.model
|
||||||
enum = self.app.enum
|
enum = self.app.enum
|
||||||
view = self.make_view()
|
view = self.make_view()
|
||||||
|
|
Loading…
Reference in a new issue