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

Mark strings for translation in cotisations

This commit is contained in:
Laouen Fernet 2019-11-16 14:02:32 +00:00 committed by chirac
parent 3743a46bc5
commit 2454de2032
19 changed files with 117 additions and 91 deletions

View file

@ -116,7 +116,7 @@ class DiscountForm(Form):
""" """
is_relative = forms.BooleanField( is_relative = forms.BooleanField(
label=_("Discount is on percentage."), required=False label=_("Discount is in percentage."), required=False
) )
discount = forms.DecimalField( discount = forms.DecimalField(
label=_("Discount"), label=_("Discount"),
@ -136,7 +136,7 @@ class DiscountForm(Form):
else: else:
amount = discount amount = discount
if amount: if amount:
name = _("{}% discount") if is_relative else _("{}€ discount") name = _("{}% discount") if is_relative else _("{} € discount")
name = name.format(discount) name = name.format(discount)
Vente.objects.create(facture=invoice, name=name, prix=-amount, number=1) Vente.objects.create(facture=invoice, name=name, prix=-amount, number=1)
@ -184,7 +184,7 @@ class DelArticleForm(FormRevMixin, Form):
articles = forms.ModelMultipleChoiceField( articles = forms.ModelMultipleChoiceField(
queryset=Article.objects.none(), queryset=Article.objects.none(),
label=_("Available articles"), label=_("Current articles"),
widget=forms.CheckboxSelectMultiple, widget=forms.CheckboxSelectMultiple,
) )
@ -226,7 +226,7 @@ class DelPaiementForm(FormRevMixin, Form):
# TODO : change paiement to payment # TODO : change paiement to payment
paiements = forms.ModelMultipleChoiceField( paiements = forms.ModelMultipleChoiceField(
queryset=Paiement.objects.none(), queryset=Paiement.objects.none(),
label=_("Available payment methods"), label=_("Current payment methods"),
widget=forms.CheckboxSelectMultiple, widget=forms.CheckboxSelectMultiple,
) )
@ -266,7 +266,7 @@ class DelBanqueForm(FormRevMixin, Form):
# TODO : change banque to bank # TODO : change banque to bank
banques = forms.ModelMultipleChoiceField( banques = forms.ModelMultipleChoiceField(
queryset=Banque.objects.none(), queryset=Banque.objects.none(),
label=_("Available banks"), label=_("Current banks"),
widget=forms.CheckboxSelectMultiple, widget=forms.CheckboxSelectMultiple,
) )

View file

@ -56,7 +56,7 @@ from cotisations.validators import check_no_balance
class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
date = models.DateTimeField(auto_now_add=True, verbose_name=_("Date")) date = models.DateTimeField(auto_now_add=True, verbose_name=_("date"))
# TODO : change prix to price # TODO : change prix to price
def prix(self): def prix(self):
@ -138,7 +138,7 @@ class Facture(BaseInvoice):
abstract = False abstract = False
permissions = ( permissions = (
# TODO : change facture to invoice # TODO : change facture to invoice
("change_facture_control", _('Can edit the "controlled" state')), ("change_facture_control", _("Can edit the \"controlled\" state")),
("view_facture", _("Can view an invoice object")), ("view_facture", _("Can view an invoice object")),
("change_all_facture", _("Can edit all the previous invoices")), ("change_all_facture", _("Can edit all the previous invoices")),
) )
@ -174,8 +174,8 @@ class Facture(BaseInvoice):
return ( return (
False, False,
_( _(
"You don't have the right to edit an invoice " "You don't have the right to edit an invoice"
"already controlled or invalidated." " already controlled or invalidated."
), ),
("cotisations.change_all_facture",), ("cotisations.change_all_facture",),
) )
@ -206,8 +206,8 @@ class Facture(BaseInvoice):
return ( return (
False, False,
_( _(
"You don't have the right to delete an invoice " "You don't have the right to delete an invoice"
"already controlled or invalidated." " already controlled or invalidated."
), ),
("cotisations.change_all_facture",), ("cotisations.change_all_facture",),
) )
@ -220,8 +220,8 @@ class Facture(BaseInvoice):
return ( return (
False, False,
_( _(
"You don't have the right to view someone else's " "You don't have the right to view someone else's"
"invoices history." " invoices history."
), ),
("cotisations.view_facture",), ("cotisations.view_facture",),
) )
@ -243,7 +243,7 @@ class Facture(BaseInvoice):
can = user_request.has_perm("cotisations.change_facture_control") can = user_request.has_perm("cotisations.change_facture_control")
return ( return (
can, can,
_('You don\'t have the right to edit the "controlled" state.') _("You don't have the right to edit the \"controlled\" state.")
if not can if not can
else None, else None,
("cotisations.change_facture_control",), ("cotisations.change_facture_control",),
@ -262,13 +262,13 @@ class Facture(BaseInvoice):
if len(Paiement.find_allowed_payments(user_request)) <= 0: if len(Paiement.find_allowed_payments(user_request)) <= 0:
return ( return (
False, False,
_("There are no payment method which you can use."), _("There are no payment methods that you can use."),
("cotisations.add_facture",), ("cotisations.add_facture",),
) )
if len(Article.find_allowed_articles(user_request, user_request)) <= 0: if len(Article.find_allowed_articles(user_request, user_request)) <= 0:
return ( return (
False, False,
_("There are no article that you can buy."), _("There are no articles that you can buy."),
("cotisations.add_facture",), ("cotisations.add_facture",),
) )
return True, None, None return True, None, None
@ -346,11 +346,11 @@ class CustomInvoice(BaseInvoice):
class Meta: class Meta:
permissions = (("view_custominvoice", _("Can view a custom invoice object")),) permissions = (("view_custominvoice", _("Can view a custom invoice object")),)
recipient = models.CharField(max_length=255, verbose_name=_("Recipient")) recipient = models.CharField(max_length=255, verbose_name=_("recipient"))
payment = models.CharField(max_length=255, verbose_name=_("Payment type")) payment = models.CharField(max_length=255, verbose_name=_("payment type"))
address = models.CharField(max_length=255, verbose_name=_("Address")) address = models.CharField(max_length=255, verbose_name=_("address"))
paid = models.BooleanField(verbose_name=_("Paid"), default=False) paid = models.BooleanField(verbose_name=_("paid"), default=False)
remark = models.TextField(verbose_name=_("Remark"), blank=True, null=True) remark = models.TextField(verbose_name=_("remark"), blank=True, null=True)
class CostEstimate(CustomInvoice): class CostEstimate(CustomInvoice):
@ -358,7 +358,7 @@ class CostEstimate(CustomInvoice):
permissions = (("view_costestimate", _("Can view a cost estimate object")),) permissions = (("view_costestimate", _("Can view a cost estimate object")),)
validity = models.DurationField( validity = models.DurationField(
verbose_name=_("Period of validity"), help_text="DD HH:MM:SS" verbose_name=_("period of validity"), help_text="DD HH:MM:SS"
) )
final_invoice = models.ForeignKey( final_invoice = models.ForeignKey(
CustomInvoice, CustomInvoice,
@ -547,7 +547,7 @@ class Vente(RevMixin, AclMixin, models.Model):
if not user_request.has_perm("cotisations.change_vente"): if not user_request.has_perm("cotisations.change_vente"):
return ( return (
False, False,
_("You don't have the right to edit the purchases."), _("You don't have the right to edit a purchase."),
("cotisations.change_vente",), ("cotisations.change_vente",),
) )
elif not (user_request.has_perm("cotisations.change_all_facture") or user_can): elif not (user_request.has_perm("cotisations.change_all_facture") or user_can):
@ -562,8 +562,8 @@ class Vente(RevMixin, AclMixin, models.Model):
return ( return (
False, False,
_( _(
"You don't have the right to edit a purchase " "You don't have the right to edit a purchase"
"already controlled or invalidated." " already controlled or invalidated."
), ),
("cotisations.change_all_vente",), ("cotisations.change_all_vente",),
) )
@ -590,8 +590,8 @@ class Vente(RevMixin, AclMixin, models.Model):
return ( return (
False, False,
_( _(
"You don't have the right to delete a purchase " "You don't have the right to delete a purchase"
"already controlled or invalidated." " already controlled or invalidated."
), ),
None, None,
) )
@ -606,8 +606,8 @@ class Vente(RevMixin, AclMixin, models.Model):
return ( return (
False, False,
_( _(
"You don't have the right to view someone " "You don't have the right to view someone"
"else's purchase history." " else's purchase history."
), ),
("cotisations.view_vente",), ("cotisations.view_vente",),
) )
@ -731,7 +731,7 @@ class Article(RevMixin, AclMixin, models.Model):
def clean(self): def clean(self):
if self.name.lower() == "solde": if self.name.lower() == "solde":
raise ValidationError(_("Balance is a reserved article name.")) raise ValidationError(_("Solde is a reserved article name."))
if self.type_cotisation and not (self.duration or self.duration_days): if self.type_cotisation and not (self.duration or self.duration_days):
raise ValidationError(_("Duration must be specified for a subscription.")) raise ValidationError(_("Duration must be specified for a subscription."))
@ -921,7 +921,7 @@ class Paiement(RevMixin, AclMixin, models.Model):
p = find_payment_method(self) p = find_payment_method(self)
if p is not None: if p is not None:
return p._meta.verbose_name return p._meta.verbose_name
return _("No custom payment method.") return _("No custom payment methods.")
class Cotisation(RevMixin, AclMixin, models.Model): class Cotisation(RevMixin, AclMixin, models.Model):
@ -976,8 +976,8 @@ class Cotisation(RevMixin, AclMixin, models.Model):
return ( return (
False, False,
_( _(
"You don't have the right to edit a subscription " "You don't have the right to edit a subscription"
"already controlled or invalidated." " already controlled or invalidated."
), ),
("cotisations.change_all_cotisation",), ("cotisations.change_all_cotisation",),
) )
@ -995,8 +995,8 @@ class Cotisation(RevMixin, AclMixin, models.Model):
return ( return (
False, False,
_( _(
"You don't have the right to delete a subscription " "You don't have the right to delete a subscription"
"already controlled or invalidated." " already controlled or invalidated."
), ),
None, None,
) )
@ -1011,8 +1011,8 @@ class Cotisation(RevMixin, AclMixin, models.Model):
return ( return (
False, False,
_( _(
"You don't have the right to view someone else's " "You don't have the right to view someone else's"
"subscription history." " subscription history."
), ),
("cotisations.view_cotisation",), ("cotisations.view_cotisation",),
) )

View file

@ -44,18 +44,17 @@ class BalancePayment(PaymentMethodMixin, models.Model):
editable=False, editable=False,
) )
minimum_balance = models.DecimalField( minimum_balance = models.DecimalField(
verbose_name=_("Minimum balance"), verbose_name=_("minimum balance"),
help_text=_( help_text=_(
"The minimal amount of money allowed for the balance" "The minimal amount of money allowed for the balance at the end"
" at the end of a payment. You can specify negative " " of a payment. You can specify a negative amount."
"amount."
), ),
max_digits=5, max_digits=5,
decimal_places=2, decimal_places=2,
default=0, default=0,
) )
maximum_balance = models.DecimalField( maximum_balance = models.DecimalField(
verbose_name=_("Maximum balance"), verbose_name=_("maximum balance"),
help_text=_("The maximal amount of money allowed for the balance."), help_text=_("The maximal amount of money allowed for the balance."),
max_digits=5, max_digits=5,
decimal_places=2, decimal_places=2,
@ -64,7 +63,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
null=True, null=True,
) )
credit_balance_allowed = models.BooleanField( credit_balance_allowed = models.BooleanField(
verbose_name=_("Allow user to credit their balance"), default=False verbose_name=_("allow user to credit their balance"), default=False
) )
def end_payment(self, invoice, request): def end_payment(self, invoice, request):

View file

@ -33,7 +33,7 @@ class ChequePayment(PaymentMethodMixin, models.Model):
""" """
class Meta: class Meta:
verbose_name = _("Cheque") verbose_name = _("cheque")
payment = models.OneToOneField( payment = models.OneToOneField(
Paiement, Paiement,

View file

@ -51,9 +51,10 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
max_length=255, null=True, blank=True, verbose_name=_("ComNpay secret key") max_length=255, null=True, blank=True, verbose_name=_("ComNpay secret key")
) )
minimum_payment = models.DecimalField( minimum_payment = models.DecimalField(
verbose_name=_("Minimum payment"), verbose_name=_("minimum payment"),
help_text=_( help_text=_(
"The minimal amount of money you have to use when paying" " with ComNpay" "The minimal amount of money you have to use when paying with"
" ComNpay."
), ),
max_digits=5, max_digits=5,
decimal_places=2, decimal_places=2,
@ -62,7 +63,7 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
production = models.BooleanField( production = models.BooleanField(
default=True, default=True,
verbose_name=_( verbose_name=_(
"Production mode enabled (production URL, instead of homologation)" "production mode enabled (production URL, instead of homologation)"
), ),
) )

View file

@ -58,9 +58,9 @@ class PaymentMethodForm(forms.Form):
payment_method = forms.ChoiceField( payment_method = forms.ChoiceField(
label=_("Special payment method"), label=_("Special payment method"),
help_text=_( help_text=_(
"Warning: you will not be able to change the payment " "Warning: you will not be able to change the payment"
"method later. But you will be allowed to edit the other " " method later. But you will be allowed to edit the other"
"options." " options."
), ),
required=False, required=False,
) )
@ -71,7 +71,7 @@ class PaymentMethodForm(forms.Form):
self.fields["payment_method"].choices = [ self.fields["payment_method"].choices = [
(i, p.NAME) for (i, p) in enumerate(PAYMENT_METHODS) (i, p.NAME) for (i, p) in enumerate(PAYMENT_METHODS)
] ]
self.fields["payment_method"].choices.insert(0, ("", _("no"))) self.fields["payment_method"].choices.insert(0, ("", _("No")))
self.fields["payment_method"].widget.attrs = {"id": "paymentMethodSelect"} self.fields["payment_method"].widget.attrs = {"id": "paymentMethodSelect"}
self.templates = [ self.templates = [
forms.modelform_factory(p.PaymentMethod, fields="__all__")(prefix=prefix) forms.modelform_factory(p.PaymentMethod, fields="__all__")(prefix=prefix)

View file

@ -51,4 +51,4 @@ class FreePayment(PaymentMethodMixin, models.Model):
"""Checks that the price meets the requirement to be paid with user """Checks that the price meets the requirement to be paid with user
balance. balance.
""" """
return (price == 0, _("You cannot validate this invoice for free.")) return (price == 0, _("You can't pay this invoice for free."))

View file

@ -30,5 +30,5 @@ class NoteCredentialForm(forms.Form):
object. object.
""" """
login = forms.CharField(label=_("pseudo note")) login = forms.CharField(label=_("Username"))
password = forms.CharField(label=_("Password"), widget=forms.PasswordInput) password = forms.CharField(label=_("Password"), widget=forms.PasswordInput)

View file

@ -31,7 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<thead> <thead>
<tr> <tr>
<th>{% trans "Payment type" %}</th> <th>{% trans "Payment type" %}</th>
<th>{% trans "Is available for everyone" %}</th> <th>{% trans "Available for everyone" %}</th>
<th>{% trans "Custom payment method" %}</th> <th>{% trans "Custom payment method" %}</th>
<th></th> <th></th>
</tr> </tr>

View file

@ -45,12 +45,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<th>{% trans "Profile" %}</th> <th>{% trans "Profile" %}</th>
<th> <th>
{% trans "Last name" as tr_last_name %} {% trans "First name" as tr_first_name %}
{% include 'buttons/sort.html' with prefix='control' col='name' text=tr_last_name %} {% include 'buttons/sort.html' with prefix='control' col='name' text=tr_first_name %}
</th> </th>
<th> <th>
{% trans "First name" as tr_first_name %} {% trans "Surname" as tr_surname %}
{% include 'buttons/sort.html' with prefix='control' col='surname' text=tr_first_name %} {% include 'buttons/sort.html' with prefix='control' col='surname' text=tr_surname %}
</th> </th>
<th> <th>
{% trans "Invoice ID" as tr_invoice_id %} {% trans "Invoice ID" as tr_invoice_id %}
@ -104,8 +104,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% trans "Edit" as tr_edit %} {% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_edit button_type='submit' icon='ok' button_class='btn-success' %} {% bootstrap_button tr_confirm button_type='submit' icon='ok' button_class='btn-success' %}
</form> </form>
{% endblock %} {% endblock %}

View file

@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<form class="form" method="post"> <form class="form" method="post">
{% csrf_token %} {% csrf_token %}
<h4> <h4>
{% blocktrans %}Warning: are you sure you really want to delete this {{ object_name }} object ( {{ objet }} )?{% endblocktrans %} {% blocktrans %}Warning: are you sure you really want to delete this {{ objet_name }} object ( {{ objet }} )?{% endblocktrans %}
</h4> </h4>
{% trans "Confirm" as tr_confirm %} {% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_confirm button_type='submit' icon='trash' button_class='btn-danger' %} {% bootstrap_button tr_confirm button_type='submit' icon='trash' button_class='btn-danger' %}

View file

@ -6,17 +6,17 @@ Nous vous remercions pour votre achat auprès de {{asso_name}} et nous vous en j
En cas de question, nhésitez pas à nous contacter par mail à {{contact_mail}}. En cas de question, nhésitez pas à nous contacter par mail à {{contact_mail}}.
Cordialement, Respectueusement,
Léquipe de {{asso_name}} Léquipe de {{asso_name}}.
=== English version === === English version ===
Dear {{name}}, Hello {{name}},
Thank you for your purchase. Here is your invoice. Thank you for your purchase at {{asso_name}}. Here is your invoice.
Should you need extra information, you can email us at {{contact_mail}}. Should you need extra information, do not hesitate to email us at {{contact_mail}}.
Best regards, Regards,
{{ asso_name }}'s team The {{ asso_name }} team.

View file

@ -6,17 +6,18 @@ Vous trouverez en pièce jointe un reçu.
Pour nous faire part de toute remarque, suggestion ou problème vous pouvez nous envoyer un mail à {{asso_email}}. Pour nous faire part de toute remarque, suggestion ou problème vous pouvez nous envoyer un mail à {{asso_email}}.
À bientôt, Respectueusement,
L'équipe de {{asso_name}}. L'équipe de {{asso_name}}.
--- ---
Hello {{name}}!
Your subscription to {{asso_name}} has just been accepted. You are now a full member of {{asso_name}} until {{ date_end|date:"d/m/Y" }}. Your subscription to {{asso_name}} has just been accepted. You are now a full member of {{asso_name}} until {{ date_end|date:"d/m/Y" }}.
You will find with this email a subscription voucher. You will find with this email a subscription voucher.
For any information, suggestion or problem, you can contact us via email at To express any comment, suggestion or problem, you can send us an email to {{asso_email}}.
{{asso_email}}.
Regards, Regards,
The {{asso_name}} team. The {{asso_name}} team.

View file

@ -30,14 +30,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Articles" %}{% endblock %} {% block title %}{% trans "Articles" %}{% endblock %}
{% block content %} {% block content %}
<h2>{% trans "List of article types" %}</h2> <h2>{% trans "List of articles" %}</h2>
{% can_create Article %} {% can_create Article %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-article' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-article' %}">
<i class="fa fa-cart-plus"></i> {% trans "Add an article type" %} <i class="fa fa-plus"></i> {% trans "Add an article" %}
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-article' %}"> <a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-article' %}">
<i class="fa fa-trash"></i> {% trans "Delete one or several article types" %} <i class="fa fa-trash"></i> {% trans "Delete one or several articles" %}
</a> </a>
{% include 'cotisations/aff_article.html' with article_list=article_list %} {% include 'cotisations/aff_article.html' with article_list=article_list %}
{% endblock %} {% endblock %}

View file

@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "List of banks" %}</h2> <h2>{% trans "List of banks" %}</h2>
{% can_create Banque %} {% can_create Banque %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-banque' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-banque' %}">
<i class="fa fa-cart-plus"></i> {% trans "Add a bank" %} <i class="fa fa-plus"></i> {% trans "Add a bank" %}
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-banque' %}"> <a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-banque' %}">

View file

@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "List of payment methods" %}</h2> <h2>{% trans "List of payment methods" %}</h2>
{% can_create Paiement %} {% can_create Paiement %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-paiement' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-paiement' %}">
<i class="fa fa-cart-plus"></i> {% trans "Add a payment method" %} <i class="fa fa-plus"></i> {% trans "Add a payment method" %}
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-paiement' %}"> <a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-paiement' %}">

View file

@ -52,7 +52,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% acl_end %} {% acl_end %}
{% can_view_all Article %} {% can_view_all Article %}
<a class="list-group-item list-group-item-info" href="{% url 'cotisations:index-article' %}"> <a class="list-group-item list-group-item-info" href="{% url 'cotisations:index-article' %}">
<i class="fa fa-list-ul"></i> {% trans "Available articles" %} <i class="fa fa-list-ul"></i> {% trans "Articles" %}
</a> </a>
{% acl_end %} {% acl_end %}
{% can_view_all Banque %} {% can_view_all Banque %}

View file

@ -36,7 +36,6 @@ from django.template.loader import get_template
from django.http import HttpResponse from django.http import HttpResponse
from django.conf import settings from django.conf import settings
from django.utils.text import slugify from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
from re2o.mixins import AclMixin, RevMixin from re2o.mixins import AclMixin, RevMixin
from preferences.models import CotisationsOption from preferences.models import CotisationsOption

View file

@ -166,6 +166,7 @@ def new_facture(request, user, userid):
"articlelist": article_list, "articlelist": article_list,
"balance": balance, "balance": balance,
"action_name": _("Confirm"), "action_name": _("Confirm"),
"title": _("New invoice"),
}, },
"cotisations/facture.html", "cotisations/facture.html",
request, request,
@ -222,7 +223,7 @@ def new_cost_estimate(request):
"articlesformset": articles_formset, "articlesformset": articles_formset,
"articlelist": articles, "articlelist": articles,
"discount_form": discount_form, "discount_form": discount_form,
"title": _("Cost estimate"), "title": _("New cost estimate"),
}, },
"cotisations/facture.html", "cotisations/facture.html",
request, request,
@ -278,6 +279,7 @@ def new_custom_invoice(request):
"articlesformset": articles_formset, "articlesformset": articles_formset,
"articlelist": articles, "articlelist": articles,
"discount_form": discount_form, "discount_form": discount_form,
"title": _("New custom invoice"),
}, },
"cotisations/facture.html", "cotisations/facture.html",
request, request,
@ -373,7 +375,7 @@ def del_facture(request, facture, **_kwargs):
messages.success(request, _("The invoice was deleted.")) messages.success(request, _("The invoice was deleted."))
return redirect(reverse("cotisations:index")) return redirect(reverse("cotisations:index"))
return form( return form(
{"objet": facture, "objet_name": _("Invoice")}, {"objet": facture, "objet_name": _("invoice")},
"cotisations/delete.html", "cotisations/delete.html",
request, request,
) )
@ -437,7 +439,11 @@ def edit_custom_invoice(request, invoice, **kwargs):
return redirect(reverse("cotisations:index-custom-invoice")) return redirect(reverse("cotisations:index-custom-invoice"))
return form( return form(
{"factureform": invoice_form, "venteform": purchase_form}, {
"factureform": invoice_form,
"venteform": purchase_form,
"title": _("Edit custom invoice"),
},
"cotisations/edit_facture.html", "cotisations/edit_facture.html",
request, request,
) )
@ -501,7 +507,7 @@ def del_cost_estimate(request, estimate, **_kwargs):
messages.success(request, _("The cost estimate was deleted.")) messages.success(request, _("The cost estimate was deleted."))
return redirect(reverse("cotisations:index-cost-estimate")) return redirect(reverse("cotisations:index-cost-estimate"))
return form( return form(
{"objet": estimate, "objet_name": _("Cost estimate")}, {"objet": estimate, "objet_name": _("cost estimate")},
"cotisations/delete.html", "cotisations/delete.html",
request, request,
) )
@ -564,7 +570,7 @@ def del_custom_invoice(request, invoice, **_kwargs):
messages.success(request, _("The invoice was deleted.")) messages.success(request, _("The invoice was deleted."))
return redirect(reverse("cotisations:index-custom-invoice")) return redirect(reverse("cotisations:index-custom-invoice"))
return form( return form(
{"objet": invoice, "objet_name": _("Invoice")}, {"objet": invoice, "objet_name": _("invoice")},
"cotisations/delete.html", "cotisations/delete.html",
request, request,
) )
@ -588,7 +594,11 @@ def add_article(request):
messages.success(request, _("The article was created.")) messages.success(request, _("The article was created."))
return redirect(reverse("cotisations:index-article")) return redirect(reverse("cotisations:index-article"))
return form( return form(
{"factureform": article, "action_name": _("Add"), "title": _("New article")}, {
"factureform": article,
"action_name": _("Add"),
"title": _("New article"),
},
"cotisations/facture.html", "cotisations/facture.html",
request, request,
) )
@ -607,7 +617,11 @@ def edit_article(request, article_instance, **_kwargs):
messages.success(request, _("The article was edited.")) messages.success(request, _("The article was edited."))
return redirect(reverse("cotisations:index-article")) return redirect(reverse("cotisations:index-article"))
return form( return form(
{"factureform": article, "action_name": _("Edit"), "title": _("Edit article")}, {
"factureform": article,
"action_name": _("Edit"),
"title": _("Edit article"),
},
"cotisations/facture.html", "cotisations/facture.html",
request, request,
) )
@ -718,8 +732,8 @@ def del_paiement(request, instances):
messages.error( messages.error(
request, request,
_( _(
"The payment method %(method_name)s can't be deleted \ "The payment method %(method_name)s can't be deleted"
because there are invoices using it." " because there are invoices using it."
) )
% {"method_name": payment_del}, % {"method_name": payment_del},
) )
@ -748,7 +762,11 @@ def add_banque(request):
messages.success(request, _("The bank was created.")) messages.success(request, _("The bank was created."))
return redirect(reverse("cotisations:index-banque")) return redirect(reverse("cotisations:index-banque"))
return form( return form(
{"factureform": bank, "action_name": _("Add"), "title": _("New bank")}, {
"factureform": bank,
"action_name": _("Add"),
"title": _("New bank"),
},
"cotisations/facture.html", "cotisations/facture.html",
request, request,
) )
@ -768,7 +786,11 @@ def edit_banque(request, banque_instance, **_kwargs):
messages.success(request, _("The bank was edited.")) messages.success(request, _("The bank was edited."))
return redirect(reverse("cotisations:index-banque")) return redirect(reverse("cotisations:index-banque"))
return form( return form(
{"factureform": bank, "action_name": _("Edit"), "title": _("Edit bank")}, {
"factureform": bank,
"action_name": _("Edit"),
"title": _("Edit bank"),
},
"cotisations/facture.html", "cotisations/facture.html",
request, request,
) )
@ -802,7 +824,11 @@ def del_banque(request, instances):
) )
return redirect(reverse("cotisations:index-banque")) return redirect(reverse("cotisations:index-banque"))
return form( return form(
{"factureform": bank, "action_name": _("Delete"), "title": _("Delete bank")}, {
"factureform": bank,
"action_name": _("Delete"),
"title": _("Delete bank"),
},
"cotisations/facture.html", "cotisations/facture.html",
request, request,
) )
@ -833,7 +859,7 @@ def control(request):
) )
if control_invoices_form.is_valid(): if control_invoices_form.is_valid():
control_invoices_form.save() control_invoices_form.save()
reversion.set_comment("Controle") reversion.set_comment("Control")
messages.success( messages.success(
request, _("Your changes have been properly taken into account.") request, _("Your changes have been properly taken into account.")
) )