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
This commit is contained in:
Lance Edgar 2018-06-27 17:29:31 -05:00
parent 0ccb6883f8
commit eeba784c32
2 changed files with 7 additions and 4 deletions

View file

@ -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)

View file

@ -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)