add accounting tst
This commit is contained in:
		@@ -57,5 +57,8 @@ class DeskAdmin(admin.ModelAdmin):
 | 
			
		||||
 | 
			
		||||
@admin.register(Accounting)
 | 
			
		||||
class AccountingAdmin(admin.ModelAdmin):
 | 
			
		||||
    list_display = ('desk', 'time_from', 'time_to', 'prize', 'billed', 'account_user')
 | 
			
		||||
    list_filter = ('desk__client__location', 'account_user', 'billed')
 | 
			
		||||
    list_display = ('desk', 'time_from', 'time_to', 'prize', 'billed', 'account_user', 'account_tst')
 | 
			
		||||
    list_filter = ('desk__client__location', 'account_user', 'account_tst', 'billed')
 | 
			
		||||
 | 
			
		||||
    def has_add_permission(self, request):
 | 
			
		||||
        return False
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										20
									
								
								billard/migrations/0023_accounting_account_tst.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								billard/migrations/0023_accounting_account_tst.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
# Generated by Django 1.11 on 2017-04-29 11:09
 | 
			
		||||
from __future__ import unicode_literals
 | 
			
		||||
 | 
			
		||||
from django.db import migrations, models
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Migration(migrations.Migration):
 | 
			
		||||
 | 
			
		||||
    dependencies = [
 | 
			
		||||
        ('billard', '0022_auto_20170427_0835'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        migrations.AddField(
 | 
			
		||||
            model_name='accounting',
 | 
			
		||||
            name='account_tst',
 | 
			
		||||
            field=models.DateTimeField(blank=True, null=True, verbose_name='Abr. TST'),
 | 
			
		||||
        ),
 | 
			
		||||
    ]
 | 
			
		||||
@@ -86,6 +86,7 @@ class Accounting(models.Model):
 | 
			
		||||
    prize_normal = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True, verbose_name="Preis Normalzeit")
 | 
			
		||||
    prize_hh = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True, verbose_name="Preis Happy Hour")
 | 
			
		||||
    account_user = models.CharField(blank=True, null=True, max_length=128, verbose_name="Abr. Benutzer")
 | 
			
		||||
    account_tst = models.DateTimeField(blank=True, null=True, verbose_name="Abr. TST")
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return '{}: {} -> {}, {}, {}'.format(self.desk, self.time_from, self.time_to, self.prize, self.billed)
 | 
			
		||||
 
 | 
			
		||||
@@ -7,9 +7,10 @@ from rest_framework import viewsets
 | 
			
		||||
from django.shortcuts import render, redirect
 | 
			
		||||
from django.views import generic
 | 
			
		||||
from django.contrib.auth.decorators import login_required, permission_required
 | 
			
		||||
from django.db.models import Min, Sum
 | 
			
		||||
from django.db.models import Sum
 | 
			
		||||
from django.http import HttpResponse
 | 
			
		||||
from django.utils.decorators import method_decorator
 | 
			
		||||
from django.utils import timezone
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class LocationIndexView(generic.ListView):
 | 
			
		||||
@@ -64,6 +65,7 @@ def accounting_confirm(request, pk):
 | 
			
		||||
            if len(acc_ids) > 0:
 | 
			
		||||
                Accounting.objects.filter(id__in=acc_ids).update(billed=True)
 | 
			
		||||
                Accounting.objects.filter(id__in=acc_ids).update(account_user=request.user.username)
 | 
			
		||||
                Accounting.objects.filter(id__in=acc_ids).update(account_tst=timezone.now())
 | 
			
		||||
    resp = redirect('billard:accounting_detail', pk=pk)
 | 
			
		||||
    return resp
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user