Handle TypeError raised in an invoice for generic product
Case: No VM_ID exists and hence int(vm_id) raises TypeError
This commit is contained in:
		
					parent
					
						
							
								a423dd9f49
							
						
					
				
			
			
				commit
				
					
						1e57eb5fae
					
				
			
		
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
					@ -1268,6 +1268,10 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView):
 | 
				
			||||||
                    context['vm']['total_price'] = (
 | 
					                    context['vm']['total_price'] = (
 | 
				
			||||||
                            price + vat - discount['amount']
 | 
					                            price + vat - discount['amount']
 | 
				
			||||||
                    )
 | 
					                    )
 | 
				
			||||||
 | 
					                except TypeError:
 | 
				
			||||||
 | 
					                    logger.error("Type error. Probably we "
 | 
				
			||||||
 | 
					                                 "came from a generic product. "
 | 
				
			||||||
 | 
					                                 "Invoice ID %s" % obj.invoice_id)
 | 
				
			||||||
                except WrongIdError:
 | 
					                except WrongIdError:
 | 
				
			||||||
                    logger.error("WrongIdError while accessing "
 | 
					                    logger.error("WrongIdError while accessing "
 | 
				
			||||||
                                 "invoice {}".format(obj.invoice_id))
 | 
					                                 "invoice {}".format(obj.invoice_id))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue