add accounting tst

This commit is contained in:
Robert Einsle 2017-04-29 11:15:26 +02:00
parent 6492c29e32
commit 673092407b
4 changed files with 29 additions and 3 deletions

View File

@ -57,5 +57,8 @@ class DeskAdmin(admin.ModelAdmin):
@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') list_display = ('desk', 'time_from', 'time_to', 'prize', 'billed', 'account_user', 'account_tst')
list_filter = ('desk__client__location', 'account_user', 'billed') list_filter = ('desk__client__location', 'account_user', 'account_tst', 'billed')
def has_add_permission(self, request):
return False

View 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'),
),
]

View File

@ -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_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") 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_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): def __str__(self):
return '{}: {} -> {}, {}, {}'.format(self.desk, self.time_from, self.time_to, self.prize, self.billed) return '{}: {} -> {}, {}, {}'.format(self.desk, self.time_from, self.time_to, self.prize, self.billed)

View File

@ -7,9 +7,10 @@ from rest_framework import viewsets
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.views import generic from django.views import generic
from django.contrib.auth.decorators import login_required, permission_required 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.http import HttpResponse
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.utils import timezone
class LocationIndexView(generic.ListView): class LocationIndexView(generic.ListView):
@ -64,6 +65,7 @@ def accounting_confirm(request, pk):
if len(acc_ids) > 0: if len(acc_ids) > 0:
Accounting.objects.filter(id__in=acc_ids).update(billed=True) 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_user=request.user.username)
Accounting.objects.filter(id__in=acc_ids).update(account_tst=timezone.now())
resp = redirect('billard:accounting_detail', pk=pk) resp = redirect('billard:accounting_detail', pk=pk)
return resp return resp