add set to billed option
This commit is contained in:
		@@ -83,12 +83,19 @@ class DeskAdmin(admin.ModelAdmin):
 | 
				
			|||||||
    list_filter = ('client', 'desk_no', 'enabled', 'prize', 'prize_hh')
 | 
					    list_filter = ('client', 'desk_no', 'enabled', 'prize', 'prize_hh')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@admin.action(description='Mark selected billings to billed')
 | 
				
			||||||
 | 
					def set_billing_true(modeladmin, request, queryset):
 | 
				
			||||||
 | 
					    queryset.update(billing=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@admin.register(Accounting)
 | 
					@admin.register(Accounting)
 | 
				
			||||||
class AccountingAdmin(admin.ModelAdmin):
 | 
					class AccountingAdmin(admin.ModelAdmin):
 | 
				
			||||||
    list_display = ('desk', 'time_from', 'time_to', 'prize', 'billed', 'account_user', 'account_tst')
 | 
					    list_display = ('desk', 'time_from', 'time_to', 'prize', 'billed', 'account_user', 'account_tst')
 | 
				
			||||||
    list_filter = ('desk__client__location', 'account_user', 'account_tst', 'billed')
 | 
					    list_filter = ('desk__client__location', 'account_user', 'account_tst', 'billed')
 | 
				
			||||||
 | 
					    actions = [set_billing_true]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def has_add_permission(self, request):
 | 
					    def has_add_permission(self, request):
 | 
				
			||||||
        if request.user.username == 'reinsle':
 | 
					        if request.user.username == 'reinsle':
 | 
				
			||||||
            return True
 | 
					            return True
 | 
				
			||||||
        return False
 | 
					        return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -169,6 +169,8 @@ INTERNAL_IPS = ['127.0.0.1']
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
DJANGO_TABLES2_TEMPLATE = 'django_tables2/bootstrap4.html'
 | 
					DJANGO_TABLES2_TEMPLATE = 'django_tables2/bootstrap4.html'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
try:
 | 
					try:
 | 
				
			||||||
    from local_settings import *
 | 
					    from local_settings import *
 | 
				
			||||||
except ImportError:
 | 
					except ImportError:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user