Changeset 053fc4e in tailbone


Ignore:
Timestamp:
07/10/18 09:06:22 (2 years ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
9dd6f8e
Parents:
44663fe
Message:

Sort mobile receiving rows by last modified instead of sequence

because we now prefer to aggregate rows for that, at least by default

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tailbone/views/purchasing/receiving.py

    r44663fe r053fc4e  
    572572    def get_mobile_row_data(self, parent):
    573573        query = self.get_row_data(parent)
    574         aggregate_products = not bool(parent.truck_dump) # TODO: make this configurable?
    575         if not aggregate_products:
    576             query = query.order_by(model.PurchaseBatchRow.sequence.desc())
    577         return query
     574        return self.sort_mobile_row_data(query)
     575
     576    def sort_mobile_row_data(self, query):
     577        return query.order_by(model.PurchaseBatchRow.modified.desc())
    578578
    579579    def render_mobile_row_listitem(self, row, i):
    580580        description = row.product.full_description if row.product else row.description
    581581        return "({}) {}".format(row.upc.pretty(), description)
     582
     583    def should_aggregate_products(self, batch):
     584        """
     585        Must return a boolean indicating whether rows should be aggregated by
     586        product for the given batch.
     587        """
     588        return True
    582589
    583590    # TODO: this view can create new rows, with only a GET query.  that should
     
    607614
    608615        if rows:
    609             aggregate_products = not bool(batch.truck_dump) # TODO: make this configurable?
    610             if aggregate_products:
     616            if self.should_aggregate_products(batch):
    611617                if len(rows) > 1:
    612618                    log.warning("found multiple UPC matches for {} in batch {}: {}".format(
Note: See TracChangeset for help on using the changeset viewer.