diff --git a/pyproject.toml b/pyproject.toml index f250b63..4b04493 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,9 +49,15 @@ sideshow_libcache = "sideshow.web.static:libcache" [project.entry-points."paste.app_factory"] "main" = "sideshow.web.app:main" +[project.entry-points."wutta.batch.neworder"] +"sideshow" = "sideshow.batch.neworder:NewOrderBatchHandler" + [project.entry-points."wutta.config.extensions"] "sideshow" = "sideshow.config:SideshowConfig" +[project.entry-points."wutta.web.menus"] +sideshow = "sideshow.web.menus:SideshowMenuHandler" + [project.urls] Homepage = "https://wuttaproject.org/" diff --git a/src/sideshow/config.py b/src/sideshow/config.py index 2a414aa..a010262 100644 --- a/src/sideshow/config.py +++ b/src/sideshow/config.py @@ -46,8 +46,12 @@ class SideshowConfig(WuttaConfigExtension): config.setdefault(f'{config.appname}.model_spec', 'sideshow.db.model') 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 - config.setdefault(f'{config.appname}.web.menus.handler_spec', + config.setdefault(f'{config.appname}.web.menus.handler.default_spec', 'sideshow.web.menus:SideshowMenuHandler') # web app libcache diff --git a/src/sideshow/web/templates/orders/configure.mako b/src/sideshow/web/templates/orders/configure.mako index a7ffccc..10d58fa 100644 --- a/src/sideshow/web/templates/orders/configure.mako +++ b/src/sideshow/web/templates/orders/configure.mako @@ -61,4 +61,32 @@ + +

Batches

+
+ + + + + + + + +
+ + +<%def name="modify_vue_vars()"> + ${parent.modify_vue_vars()} + diff --git a/src/sideshow/web/views/orders.py b/src/sideshow/web/views/orders.py index 80c9d24..a48546e 100644 --- a/src/sideshow/web/views/orders.py +++ b/src/sideshow/web/views/orders.py @@ -163,7 +163,7 @@ class OrderView(MasterView): Returns the configured :term:`handler` for :term:`new order batches `. - 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. :returns: @@ -172,9 +172,7 @@ class OrderView(MasterView): """ if hasattr(self, 'batch_handler'): return self.batch_handler - - # TODO - return NewOrderBatchHandler(self.config) + return self.app.get_batch_handler('neworder') def create(self): """ @@ -863,6 +861,9 @@ class OrderView(MasterView): """ """ settings = [ + # batches + {'name': 'wutta.batch.neworder.handler.spec'}, + # customers {'name': 'sideshow.orders.use_local_customers', # 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 + handlers = self.app.get_batch_handler_specs('neworder') + handlers = [{'spec': spec} for spec in handlers] + context['batch_handlers'] = handlers + return context @classmethod diff --git a/tests/web/views/test_orders.py b/tests/web/views/test_orders.py index 278c674..98d00cd 100644 --- a/tests/web/views/test_orders.py +++ b/tests/web/views/test_orders.py @@ -42,6 +42,8 @@ class TestOrderView(WebTestCase): def test_create(self): self.pyramid_config.include('sideshow.web.views') + self.config.setdefault('wutta.batch.neworder.handler.spec', + 'sideshow.batch.neworder:NewOrderBatchHandler') model = self.app.model enum = self.app.enum view = self.make_view()