From eeba784c3226dc71c251b5099d14de7db1b76367 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 27 Jun 2018 17:29:31 -0500 Subject: [PATCH] Be smarter about when we sort receiving batch by most recent (for mobile) i.e. only do so when *not* aggregating products, since that probably needs a closer look first --- tailbone/views/purchasing/batch.py | 4 ---- tailbone/views/purchasing/receiving.py | 7 +++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tailbone/views/purchasing/batch.py b/tailbone/views/purchasing/batch.py index bf03fcda..b4156edf 100644 --- a/tailbone/views/purchasing/batch.py +++ b/tailbone/views/purchasing/batch.py @@ -364,10 +364,6 @@ class PurchasingBatchView(BatchMasterView): 'vendor_contact', 'status_code') - def get_mobile_row_data(self, parent): - query = self.get_row_data(parent) - return query.order_by(model.PurchaseBatchRow.sequence.desc()) - def configure_mobile_form(self, f): super(PurchasingBatchView, self).configure_mobile_form(f) diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index 9dcacaf3..212a5073 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -563,6 +563,13 @@ class ReceivingBatchView(PurchasingBatchView): f.set_readonly('po_total') f.set_readonly('invoice_total') + def get_mobile_row_data(self, parent): + query = self.get_row_data(parent) + aggregate_products = not bool(parent.truck_dump) # TODO: make this configurable? + if not aggregate_products: + query = query.order_by(model.PurchaseBatchRow.sequence.desc()) + return query + def render_mobile_row_listitem(self, row, i): description = row.product.full_description if row.product else row.description return "({}) {}".format(row.upc.pretty(), description)