Add support for new credit_total field for purchase credits
				
					
				
			This commit is contained in:
		
							parent
							
								
									b66af5903b
								
							
						
					
					
						commit
						da10c6503c
					
				
					 2 changed files with 10 additions and 2 deletions
				
			
		| 
						 | 
					@ -58,7 +58,7 @@ class PurchaseCreditView(MasterView):
 | 
				
			||||||
        'size',
 | 
					        'size',
 | 
				
			||||||
        'cases_shorted',
 | 
					        'cases_shorted',
 | 
				
			||||||
        'units_shorted',
 | 
					        'units_shorted',
 | 
				
			||||||
        'invoice_total',
 | 
					        'credit_total',
 | 
				
			||||||
        'credit_type',
 | 
					        'credit_type',
 | 
				
			||||||
        'mispick_upc',
 | 
					        'mispick_upc',
 | 
				
			||||||
        'date_received',
 | 
					        'date_received',
 | 
				
			||||||
| 
						 | 
					@ -83,7 +83,7 @@ class PurchaseCreditView(MasterView):
 | 
				
			||||||
        # g.set_type('upc', 'gpc')
 | 
					        # g.set_type('upc', 'gpc')
 | 
				
			||||||
        g.set_type('cases_shorted', 'quantity')
 | 
					        g.set_type('cases_shorted', 'quantity')
 | 
				
			||||||
        g.set_type('units_shorted', 'quantity')
 | 
					        g.set_type('units_shorted', 'quantity')
 | 
				
			||||||
        g.set_type('invoice_total', 'currency')
 | 
					        g.set_type('credit_total', 'currency')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        g.set_label('invoice_number', "Invoice No.")
 | 
					        g.set_label('invoice_number', "Invoice No.")
 | 
				
			||||||
        g.set_label('upc', "UPC")
 | 
					        g.set_label('upc', "UPC")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -715,6 +715,14 @@ class ReceivingBatchView(PurchasingBatchView):
 | 
				
			||||||
        credit.invoice_case_cost = row.invoice_case_cost
 | 
					        credit.invoice_case_cost = row.invoice_case_cost
 | 
				
			||||||
        credit.invoice_unit_cost = row.invoice_unit_cost
 | 
					        credit.invoice_unit_cost = row.invoice_unit_cost
 | 
				
			||||||
        credit.invoice_total = row.invoice_total
 | 
					        credit.invoice_total = row.invoice_total
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # calculate credit total
 | 
				
			||||||
 | 
					        # TODO: should this leverage case cost if present?
 | 
				
			||||||
 | 
					        credit_units = self.handler.get_units(credit.cases_shorted,
 | 
				
			||||||
 | 
					                                              credit.units_shorted,
 | 
				
			||||||
 | 
					                                              credit.case_quantity)
 | 
				
			||||||
 | 
					        credit.credit_total = credit_units * (credit.invoice_unit_cost or 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        credit.product_discarded = discarded
 | 
					        credit.product_discarded = discarded
 | 
				
			||||||
        if credit_type == 'expired':
 | 
					        if credit_type == 'expired':
 | 
				
			||||||
            credit.expiration_date = expiration_date
 | 
					            credit.expiration_date = expiration_date
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue