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:
		
							parent
							
								
									0ccb6883f8
								
							
						
					
					
						commit
						eeba784c32
					
				
					 2 changed files with 7 additions and 4 deletions
				
			
		| 
						 | 
					@ -364,10 +364,6 @@ class PurchasingBatchView(BatchMasterView):
 | 
				
			||||||
                            'vendor_contact',
 | 
					                            'vendor_contact',
 | 
				
			||||||
                            'status_code')
 | 
					                            '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):
 | 
					    def configure_mobile_form(self, f):
 | 
				
			||||||
        super(PurchasingBatchView, self).configure_mobile_form(f)
 | 
					        super(PurchasingBatchView, self).configure_mobile_form(f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -563,6 +563,13 @@ class ReceivingBatchView(PurchasingBatchView):
 | 
				
			||||||
        f.set_readonly('po_total')
 | 
					        f.set_readonly('po_total')
 | 
				
			||||||
        f.set_readonly('invoice_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):
 | 
					    def render_mobile_row_listitem(self, row, i):
 | 
				
			||||||
        description = row.product.full_description if row.product else row.description
 | 
					        description = row.product.full_description if row.product else row.description
 | 
				
			||||||
        return "({}) {}".format(row.upc.pretty(), description)
 | 
					        return "({}) {}".format(row.upc.pretty(), description)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue