Merge branch 'release/0.2.1'

This commit is contained in:
Robert Einsle 2017-08-01 07:57:19 +02:00
commit 73fe29b4a4
6 changed files with 15 additions and 10 deletions

View File

@ -61,4 +61,6 @@ class AccountingAdmin(admin.ModelAdmin):
list_filter = ('desk__client__location', 'account_user', 'account_tst', 'billed')
def has_add_permission(self, request):
if request.user.username == 'reinsle':
return True
return False

View File

@ -100,4 +100,4 @@ class Accounting(models.Model):
@receiver(post_save, sender=LocationData)
def test(sender, **kwargs):
from .tasks import process_location_data
process_location_data.delay()
process_location_data()

View File

@ -10,7 +10,7 @@ log = logging.getLogger(__name__)
@shared_task
def process_location_data():
data = LocationData.objects.filter(processed=False)
data = LocationData.objects.filter(processed=False).order_by('tst')
for ld in data:
cli = Client.objects.filter(uuid=ld.client_id, desks__desk_no=ld.desk_no)
if cli.count() < 1:

View File

@ -44,7 +44,7 @@
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">rel. c@0.2.0</a></li>
<li><a href="#">c@0.2.1</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>

View File

@ -43,7 +43,8 @@ class AccountingView(generic.ListView):
context_object_name = 'accounting'
def get_queryset(self):
return Accounting.objects.filter(billed=False).exclude(time_to__isnull=True).order_by('time_from')
return Accounting.objects.filter(billed=False).filter(desk__client__location_id=self.kwargs['pk'])\
.exclude(time_to__isnull=True).order_by('time_from')
def dispatch(self, request, *args, **kwargs):
result = super(AccountingView, self).dispatch(request, *args, **kwargs)
@ -63,9 +64,11 @@ def accounting_confirm(request, pk):
if 'accountings' in request.POST:
acc_ids = ast.literal_eval(request.POST['accountings'])
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())
Accounting.objects.filter(id__in=acc_ids).update(
billed=True,
account_user=request.user.username,
account_tst=timezone.now(),
)
resp = redirect('billard:accounting_detail', pk=pk)
return resp

View File

@ -1,6 +1,6 @@
celery==4.0.2
Django==1.11
Django>=1.11
django-crispy-forms==1.6.1
django-extensions==1.7.8
djangorestframework==3.6.2
django-extensions>=1.7.0
djangorestframework>=3.6.0
requests==2.13.0