Remove sorter for "Credits?" column in purchasing batch row grid
too convoluted, and broken per recent sort overhaul
This commit is contained in:
parent
954a2b78be
commit
aaf6f05820
|
@ -31,7 +31,6 @@ import logging
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
import humanize
|
import humanize
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
from rattail import pod
|
from rattail import pod
|
||||||
from rattail.time import localtime, make_utc
|
from rattail.time import localtime, make_utc
|
||||||
|
@ -1002,16 +1001,6 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
g.set_click_handler('invoice_unit_cost',
|
g.set_click_handler('invoice_unit_cost',
|
||||||
'this.invoiceUnitCostClicked')
|
'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(
|
show_ordered = self.rattail_config.getbool(
|
||||||
'rattail.batch', 'purchase.receiving.show_ordered_column_in_grid',
|
'rattail.batch', 'purchase.receiving.show_ordered_column_in_grid',
|
||||||
default=False)
|
default=False)
|
||||||
|
|
Loading…
Reference in a new issue