Don't aggregate product for mobile truck dump receiving
also sort batch rows by most recent, for receiver convenience
This commit is contained in:
		
							parent
							
								
									da10c6503c
								
							
						
					
					
						commit
						0ccb6883f8
					
				
					 2 changed files with 18 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -364,6 +364,10 @@ 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)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -593,10 +593,20 @@ class ReceivingBatchView(PurchasingBatchView):
 | 
			
		|||
                           .all()
 | 
			
		||||
 | 
			
		||||
        if rows:
 | 
			
		||||
            if len(rows) > 1:
 | 
			
		||||
                log.warning("found multiple UPC matches for {} in batch {}: {}".format(
 | 
			
		||||
                    upc, batch.id_str, batch))
 | 
			
		||||
            row = rows[0]
 | 
			
		||||
            aggregate_products = not bool(batch.truck_dump) # TODO: make this configurable?
 | 
			
		||||
            if aggregate_products:
 | 
			
		||||
                if len(rows) > 1:
 | 
			
		||||
                    log.warning("found multiple UPC matches for {} in batch {}: {}".format(
 | 
			
		||||
                        upc, batch.id_str, batch))
 | 
			
		||||
                row = rows[0]
 | 
			
		||||
 | 
			
		||||
            else:
 | 
			
		||||
                other_row = rows[0]
 | 
			
		||||
                row = model.PurchaseBatchRow()
 | 
			
		||||
                row.product = other_row.product
 | 
			
		||||
                self.handler.add_row(batch, row)
 | 
			
		||||
                # TODO: is this necessary here? is so, then what about further below?
 | 
			
		||||
                # self.handler.refresh_batch_status(batch)
 | 
			
		||||
 | 
			
		||||
        else:
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue