fix: add xref button to customer profile, for trainwreck txn view
This commit is contained in:
		
							parent
							
								
									19e65f5bb9
								
							
						
					
					
						commit
						b7d26b6b8c
					
				
					 1 changed files with 17 additions and 0 deletions
				
			
		|  | @ -270,6 +270,23 @@ class TransactionView(MasterView): | |||
| 
 | ||||
|         return kwargs | ||||
| 
 | ||||
|     def get_xref_buttons(self, txn): | ||||
|         app = self.get_rattail_app() | ||||
|         clientele = app.get_clientele_handler() | ||||
|         buttons = super().get_xref_buttons(txn) | ||||
| 
 | ||||
|         if txn.customer_id: | ||||
|             customer = clientele.locate_customer_for_key(Session(), txn.customer_id) | ||||
|             if customer: | ||||
|                 person = app.get_person(customer) | ||||
|                 if person: | ||||
|                     url = self.request.route_url('people.view_profile', uuid=person.uuid) | ||||
|                     buttons.append(self.make_xref_button(text=str(person), | ||||
|                                                          url=url, | ||||
|                                                          internal=True)) | ||||
| 
 | ||||
|         return buttons | ||||
| 
 | ||||
|     def get_row_data(self, transaction): | ||||
|         return self.Session.query(self.model_row_class)\ | ||||
|                            .filter(self.model_row_class.transaction == transaction) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar