From 3990854d42f3c8bceded8664fdea78f30465e9d3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 6 Nov 2021 20:31:55 -0500 Subject: [PATCH] Fix product URL for a new custorder scenario --- tailbone/templates/custorders/create.mako | 4 ++-- tailbone/views/custorders/orders.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tailbone/templates/custorders/create.mako b/tailbone/templates/custorders/create.mako index 3daff955..a78eed6c 100644 --- a/tailbone/templates/custorders/create.mako +++ b/tailbone/templates/custorders/create.mako @@ -527,6 +527,7 @@ type="is-primary" tag="a" target="_blank" :href="productURL" + :disabled="!productURL" icon-pack="fas" icon-left="external-link-alt"> View Product @@ -1536,8 +1537,7 @@ this.productUnitPriceDisplay = selected.unit_price_display this.productCasePriceDisplay = selected.case_price_display this.productImageURL = selected.image_url - // TODO: this needs to come from handler i guess.. - // this.productURL = row.product_url + this.productURL = selected.url this.productQuantity = 1 this.productUnitChoices = selected.uom_choices // TODO: seems like the default should not be so generic? diff --git a/tailbone/views/custorders/orders.py b/tailbone/views/custorders/orders.py index a6304976..79753c50 100644 --- a/tailbone/views/custorders/orders.py +++ b/tailbone/views/custorders/orders.py @@ -183,13 +183,17 @@ class CustomerOrderView(MasterView): def configure_row_grid(self, g): super(CustomerOrderView, self).configure_row_grid(g) + app = self.get_rattail_app() + handler = app.get_batch_handler( + 'custorder', + default='rattail.batch.custorder:CustomerOrderBatchHandler') g.set_type('case_quantity', 'quantity') g.set_type('order_quantity', 'quantity') g.set_type('cases_ordered', 'quantity') g.set_type('units_ordered', 'quantity') - if self.handler.product_price_may_be_questionable(): + if handler.product_price_may_be_questionable(): g.set_renderer('total_price', self.render_price_with_confirmation) else: g.set_type('total_price', 'currency')