8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 11:23:10 +00:00

Typos, pep8 et company.

This commit is contained in:
Hugo LEVY-FALK 2018-07-03 13:58:10 +02:00
parent 0fe430d72e
commit af3cc1cf69
3 changed files with 38 additions and 35 deletions

View file

@ -221,7 +221,7 @@ class Facture(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
@staticmethod
def can_create(user_request, *_args, **_kwargs):
"""Check if an user can create an invoice.
"""Check if a user can create an invoice.
:param user_request: The user who wants to create an invoice.
:return: a message and a boolean which is True if the user can create

View file

@ -101,13 +101,16 @@ def new_facture(request, user, userid):
# Building the invocie form and the article formset
is_self_subscription = False
can_create_invoice = request.user.has_perm('cotisations.add_facture')
allow_self_subscription = OptionalUser.get_cached_value('allow_self_subscription')
allow_self_subscription = OptionalUser.get_cached_value(
'allow_self_subscription')
if not can_create_invoice:
if allow_self_subscription:
is_self_subscription = True
article_list = article_list.filter(allow_self_subscription=True)
allowed_payment = Paiement.objects.filter(allow_self_subscription=True)
invoice_form = NewFactureForm(request.POST or None, instance=invoice, allowed_payment=allowed_payment)
allowed_payment = Paiement.objects.filter(
allow_self_subscription=True)
invoice_form = NewFactureForm(
request.POST or None, instance=invoice, allowed_payment=allowed_payment)
else:
messages.error(
request,
@ -123,12 +126,12 @@ def new_facture(request, user, userid):
if request.user.is_class_club:
article_formset = formset_factory(SelectClubArticleForm)(
request.POST or None,
form_kwargs={'is_self_subscription':is_self_subscription}
form_kwargs={'is_self_subscription': is_self_subscription}
)
else:
article_formset = formset_factory(SelectUserArticleForm)(
request.POST or None,
form_kwargs={'is_self_subscription':is_self_subscription}
form_kwargs={'is_self_subscription': is_self_subscription}
)
if invoice_form.is_valid() and article_formset.is_valid():
@ -165,7 +168,6 @@ def new_facture(request, user, userid):
))
new_invoice_instance.save()
# Building a purchase for each article sold
for art_item in articles:
if art_item.cleaned_data:

View file

@ -287,7 +287,8 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
{% if user_solde %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new_facture_solde' user.id %}">
<i class="fa fa-euro-sign"></i>
Ajouter une cotisation par solde</a>
Ajouter une cotisation par solde
</a>
{% endif %}
{% acl_end %}
</div>