Adds the link_view concept to reports; adds a link_view to credit notes report
This commit is contained in:
		
							parent
							
								
									372512c6af
								
							
						
					
					
						commit
						f9e26a2e49
					
				
					 2 changed files with 11 additions and 2 deletions
				
			
		|  | @ -23,9 +23,10 @@ _all_report_views = [] | |||
| 
 | ||||
| class Report(object): | ||||
| 
 | ||||
|     def __init__(self, title, headings, data): | ||||
|     def __init__(self, title, headings, data, link_view=None): | ||||
|         self._headings = headings | ||||
|         self._data = data | ||||
|         self._link_view = link_view | ||||
| 
 | ||||
|     @property | ||||
|     def title(self): | ||||
|  | @ -42,6 +43,14 @@ class Report(object): | |||
|         ''' Returns the data rows for the table. ''' | ||||
|         return self._data | ||||
| 
 | ||||
|     @property | ||||
|     def link_view(self): | ||||
|         ''' Returns the URL name or the view callable that can be used to | ||||
|         view the row's detail. The left-most value is passed into `reverse` | ||||
|         as an argument. ''' | ||||
| 
 | ||||
|         return self._link_view | ||||
| 
 | ||||
| 
 | ||||
| def report_view(title, form_type=None): | ||||
|     ''' Decorator that converts a report view function into something that | ||||
|  |  | |||
|  | @ -199,4 +199,4 @@ def credit_notes(request, form): | |||
|             note.value, | ||||
|         ]) | ||||
| 
 | ||||
|     return Report("Credit Notes", headings, data) | ||||
|     return Report("Credit Notes", headings, data, link_view="credit_note") | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Christopher Neugebauer
						Christopher Neugebauer