mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 19:33:11 +00:00
Typos, pep8 et company.
This commit is contained in:
parent
0fe430d72e
commit
af3cc1cf69
3 changed files with 38 additions and 35 deletions
|
@ -221,7 +221,7 @@ class Facture(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def can_create(user_request, *_args, **_kwargs):
|
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.
|
: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
|
: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
|
# Building the invocie form and the article formset
|
||||||
is_self_subscription = False
|
is_self_subscription = False
|
||||||
can_create_invoice = request.user.has_perm('cotisations.add_facture')
|
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 not can_create_invoice:
|
||||||
if allow_self_subscription:
|
if allow_self_subscription:
|
||||||
is_self_subscription = True
|
is_self_subscription = True
|
||||||
article_list = article_list.filter(allow_self_subscription=True)
|
article_list = article_list.filter(allow_self_subscription=True)
|
||||||
allowed_payment = Paiement.objects.filter(allow_self_subscription=True)
|
allowed_payment = Paiement.objects.filter(
|
||||||
invoice_form = NewFactureForm(request.POST or None, instance=invoice, allowed_payment=allowed_payment)
|
allow_self_subscription=True)
|
||||||
|
invoice_form = NewFactureForm(
|
||||||
|
request.POST or None, instance=invoice, allowed_payment=allowed_payment)
|
||||||
else:
|
else:
|
||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
|
@ -123,12 +126,12 @@ def new_facture(request, user, userid):
|
||||||
if request.user.is_class_club:
|
if request.user.is_class_club:
|
||||||
article_formset = formset_factory(SelectClubArticleForm)(
|
article_formset = formset_factory(SelectClubArticleForm)(
|
||||||
request.POST or None,
|
request.POST or None,
|
||||||
form_kwargs={'is_self_subscription':is_self_subscription}
|
form_kwargs={'is_self_subscription': is_self_subscription}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
article_formset = formset_factory(SelectUserArticleForm)(
|
article_formset = formset_factory(SelectUserArticleForm)(
|
||||||
request.POST or None,
|
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():
|
if invoice_form.is_valid() and article_formset.is_valid():
|
||||||
|
@ -165,7 +168,6 @@ def new_facture(request, user, userid):
|
||||||
))
|
))
|
||||||
new_invoice_instance.save()
|
new_invoice_instance.save()
|
||||||
|
|
||||||
|
|
||||||
# Building a purchase for each article sold
|
# Building a purchase for each article sold
|
||||||
for art_item in articles:
|
for art_item in articles:
|
||||||
if art_item.cleaned_data:
|
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 %}
|
{% if user_solde %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new_facture_solde' user.id %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:new_facture_solde' user.id %}">
|
||||||
<i class="fa fa-euro-sign"></i>
|
<i class="fa fa-euro-sign"></i>
|
||||||
Ajouter une cotisation par solde</a>
|
Ajouter une cotisation par solde
|
||||||
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue