From aaf6f05820fc771c856da5d454f10bfbd91a6714 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 19 Oct 2023 13:02:17 -0500 Subject: [PATCH] Remove sorter for "Credits?" column in purchasing batch row grid too convoluted, and broken per recent sort overhaul --- tailbone/views/purchasing/receiving.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index 3e78dfea..5ccf6081 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -31,7 +31,6 @@ import logging from collections import OrderedDict import humanize -import sqlalchemy as sa from rattail import pod from rattail.time import localtime, make_utc @@ -1002,16 +1001,6 @@ class ReceivingBatchView(PurchasingBatchView): g.set_click_handler('invoice_unit_cost', 'this.invoiceUnitCostClicked') - # credits - # note that sorting by credits involves a subquery with group by clause. - # seems likely there may be a better way? but this seems to work fine - Credits = self.Session.query(model.PurchaseBatchCredit.row_uuid, - sa.func.count().label('credit_count'))\ - .group_by(model.PurchaseBatchCredit.row_uuid)\ - .subquery() - g.set_joiner('credits', lambda q: q.outerjoin(Credits)) - g.set_sorter('credits', Credits.c.credit_count) - show_ordered = self.rattail_config.getbool( 'rattail.batch', 'purchase.receiving.show_ordered_column_in_grid', default=False)