8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 04:13:12 +00:00

fix: Minor fixes to deposit app

This commit is contained in:
Jean-Romain Garnier 2021-08-06 14:18:38 +02:00
parent 824d882b81
commit 32b126d839
6 changed files with 8 additions and 6 deletions

View file

@ -26,14 +26,13 @@ from django import forms
from django.forms import Form, ModelForm
from django.utils.translation import ugettext_lazy as _
from re2o.field_permissions import FieldPermissionFormMixin
from re2o.mixins import FormRevMixin
from re2o.widgets import AutocompleteModelWidget
from .models import Deposit, DepositItem
class DepositForm(FieldPermissionFormMixin, FormRevMixin, ModelForm):
class DepositForm(FormRevMixin, ModelForm):
"""
Form used to manage and create an invoice and its fields.
"""
@ -45,6 +44,8 @@ class DepositForm(FieldPermissionFormMixin, FormRevMixin, ModelForm):
self.fields["user"].label = _("Member")
self.fields["user"].empty_label = _("Select the proprietary member")
self.fields["returned"].label = _("Deposit returned")
else:
self.fields = {"item": self.fields["item"]}
class Meta:
model = Deposit

View file

@ -50,7 +50,7 @@ class Deposit(RevMixin, AclMixin, models.Model):
item = models.ForeignKey("DepositItem", on_delete=models.PROTECT)
date = models.DateTimeField(auto_now_add=True, verbose_name=_("date"))
returned = models.BooleanField(default=False, verbose_name=_("returned"))
return_date = models.DateTimeField(default=None, verbose_name=_("return date"))
return_date = models.DateTimeField(default=None, null=True, verbose_name=_("return date"))
class Meta:
abstract = False

View file

@ -36,7 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% for item in item_list %}
<tr>
<td>{{ item.name }}</td>
<td>{{ item.deposit_amount }}</td>
<td>{{ item.deposit_amount }}</td>
<td class="text-right">
{% can_edit item %}
{% include 'buttons/edit.html' with href='deposits:edit-deposit-item' id=item.id %}

View file

@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div id="deposits" class="panel-collapse collapse">
<div class="panel-body">
{% can_create Deposit %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'deposits:new-deposit' %}">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'deposits:new-deposit' users.id %}">
<i class="fa fa-balance-scale"></i> {% trans "Add a deposit" %}
</a>
{% acl_end %}

View file

@ -228,6 +228,7 @@ def aff_profil(request, user):
deposits = re2o_paginator(request, deposits_list, pagination_number)
context = {
"user": user,
"deposits_list": deposits,
}
return render_to_string(