Commit af3cc1cf authored by Hugo LEVY-FALK's avatar Hugo LEVY-FALK

Typos, pep8 et company.

parent 0fe430d7
......@@ -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
......
......@@ -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:
......
......@@ -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>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment