8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 23:43:47 +00:00

Translation of cotisations/ (front)

This commit is contained in:
Laouen Fernet 2018-06-23 19:54:20 +02:00
parent 0193f474a0
commit a06082c6d4
29 changed files with 923 additions and 636 deletions

View file

@ -42,4 +42,5 @@ def can_view(user):
if can:
return can, None
else:
return can, _("You don't have the rights to see this application.")
return can, _("You don't have the right to view this application.")

View file

@ -40,8 +40,8 @@ from django import forms
from django.db.models import Q
from django.forms import ModelForm, Form
from django.core.validators import MinValueValidator
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy as _l
from django.utils.translation import ugettext_lazy as _
from django.shortcuts import get_object_or_404
from re2o.field_permissions import FieldPermissionFormMixin
@ -93,11 +93,11 @@ class SelectUserArticleForm(FormRevMixin, Form):
queryset=Article.objects.filter(
Q(type_user='All') | Q(type_user='Adherent')
),
label=_l("Article"),
label=_("Article"),
required=True
)
quantity = forms.IntegerField(
label=_l("Quantity"),
label=_("Quantity"),
validators=[MinValueValidator(1)],
required=True
)
@ -117,11 +117,11 @@ class SelectClubArticleForm(Form):
queryset=Article.objects.filter(
Q(type_user='All') | Q(type_user='Club')
),
label=_l("Article"),
label=_("Article"),
required=True
)
quantity = forms.IntegerField(
label=_l("Quantity"),
label=_("Quantity"),
validators=[MinValueValidator(1)],
required=True
)
@ -161,7 +161,7 @@ class DelArticleForm(FormRevMixin, Form):
"""
articles = forms.ModelMultipleChoiceField(
queryset=Article.objects.none(),
label=_l("Existing articles"),
label=_("Available articles"),
widget=forms.CheckboxSelectMultiple
)
@ -201,7 +201,7 @@ class DelPaiementForm(FormRevMixin, Form):
# TODO : change paiement to payment
paiements = forms.ModelMultipleChoiceField(
queryset=Paiement.objects.none(),
label=_l("Existing payment method"),
label=_("Available payment methods"),
widget=forms.CheckboxSelectMultiple
)
@ -239,7 +239,7 @@ class DelBanqueForm(FormRevMixin, Form):
# TODO : change banque to bank
banques = forms.ModelMultipleChoiceField(
queryset=Banque.objects.none(),
label=_l("Existing banks"),
label=_("Available banks"),
widget=forms.CheckboxSelectMultiple
)
@ -258,13 +258,13 @@ class RechargeForm(FormRevMixin, Form):
Form used to refill a user's balance
"""
value = forms.FloatField(
label=_l("Amount"),
label=_("Amount"),
min_value=0.01,
validators=[]
)
payment = forms.ModelChoiceField(
queryset=Paiement.objects.none(),
label=_l("Payment method")
label=_("Payment method")
)
def __init__(self, *args, user=None, **kwargs):
@ -290,3 +290,4 @@ class RechargeForm(FormRevMixin, Form):
}
)
return self.cleaned_data

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,181 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-08-18 11:19
from __future__ import unicode_literals
import cotisations.validators
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import re2o.aes_field
class Migration(migrations.Migration):
dependencies = [
('cotisations', '0032_custom_invoice'),
]
operations = [
migrations.AlterModelOptions(
name='article',
options={'permissions': (('view_article', 'Can view an article object'), ('buy_every_article', 'Can buy every article')), 'verbose_name': 'article', 'verbose_name_plural': 'articles'},
),
migrations.AlterModelOptions(
name='balancepayment',
options={'verbose_name': 'user balance'},
),
migrations.AlterModelOptions(
name='banque',
options={'permissions': (('view_banque', 'Can view a bank object'),), 'verbose_name': 'bank', 'verbose_name_plural': 'banks'},
),
migrations.AlterModelOptions(
name='cotisation',
options={'permissions': (('view_cotisation', 'Can view a subscription object'), ('change_all_cotisation', 'Can edit the previous subscriptions')), 'verbose_name': 'subscription', 'verbose_name_plural': 'subscriptions'},
),
migrations.AlterModelOptions(
name='custominvoice',
options={'permissions': (('view_custominvoice', 'Can view a custom invoice object'),)},
),
migrations.AlterModelOptions(
name='facture',
options={'permissions': (('change_facture_control', 'Can edit the "controlled" state'), ('view_facture', 'Can view an invoice object'), ('change_all_facture', 'Can edit all the previous invoices')), 'verbose_name': 'invoice', 'verbose_name_plural': 'invoices'},
),
migrations.AlterModelOptions(
name='paiement',
options={'permissions': (('view_paiement', 'Can view a payment method object'), ('use_every_payment', 'Can use every payment method')), 'verbose_name': 'payment method', 'verbose_name_plural': 'payment methods'},
),
migrations.AlterModelOptions(
name='vente',
options={'permissions': (('view_vente', 'Can view a purchase object'), ('change_all_vente', 'Can edit all the previous purchases')), 'verbose_name': 'purchase', 'verbose_name_plural': 'purchases'},
),
migrations.AlterField(
model_name='article',
name='available_for_everyone',
field=models.BooleanField(default=False, verbose_name='is available for every user'),
),
migrations.AlterField(
model_name='article',
name='duration',
field=models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)], verbose_name='duration (in months)'),
),
migrations.AlterField(
model_name='article',
name='name',
field=models.CharField(max_length=255, verbose_name='designation'),
),
migrations.AlterField(
model_name='article',
name='prix',
field=models.DecimalField(decimal_places=2, max_digits=5, verbose_name='unit price'),
),
migrations.AlterField(
model_name='article',
name='type_cotisation',
field=models.CharField(blank=True, choices=[('Connexion', 'Connection'), ('Adhesion', 'Membership'), ('All', 'Both of them')], default=None, max_length=255, null=True, verbose_name='subscription type'),
),
migrations.AlterField(
model_name='article',
name='type_user',
field=models.CharField(choices=[('Adherent', 'Member'), ('Club', 'Club'), ('All', 'Both of them')], default='All', max_length=255, verbose_name='type of users concerned'),
),
migrations.AlterField(
model_name='banque',
name='name',
field=models.CharField(max_length=255),
),
migrations.AlterField(
model_name='comnpaypayment',
name='payment_credential',
field=models.CharField(blank=True, default='', max_length=255, verbose_name='ComNpay VAT Number'),
),
migrations.AlterField(
model_name='comnpaypayment',
name='payment_pass',
field=re2o.aes_field.AESEncryptedField(blank=True, max_length=255, null=True, verbose_name='ComNpay secret key'),
),
migrations.AlterField(
model_name='comnpaypayment',
name='production',
field=models.BooleanField(default=True, verbose_name='Production mode enabled (production URL, instead of homologation)'),
),
migrations.AlterField(
model_name='cotisation',
name='date_end',
field=models.DateTimeField(verbose_name='end date'),
),
migrations.AlterField(
model_name='cotisation',
name='date_start',
field=models.DateTimeField(verbose_name='start date'),
),
migrations.AlterField(
model_name='cotisation',
name='type_cotisation',
field=models.CharField(choices=[('Connexion', 'Connection'), ('Adhesion', 'Membership'), ('All', 'Both of them')], default='All', max_length=255, verbose_name='subscription type'),
),
migrations.AlterField(
model_name='cotisation',
name='vente',
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to='cotisations.Vente', verbose_name='purchase'),
),
migrations.AlterField(
model_name='facture',
name='cheque',
field=models.CharField(blank=True, max_length=255, verbose_name='cheque number'),
),
migrations.AlterField(
model_name='facture',
name='control',
field=models.BooleanField(default=False, verbose_name='controlled'),
),
migrations.AlterField(
model_name='facture',
name='valid',
field=models.BooleanField(default=True, verbose_name='validated'),
),
migrations.AlterField(
model_name='paiement',
name='available_for_everyone',
field=models.BooleanField(default=False, verbose_name='is available for every user'),
),
migrations.AlterField(
model_name='paiement',
name='is_balance',
field=models.BooleanField(default=False, editable=False, help_text='There should be only one balance payment method.', validators=[cotisations.validators.check_no_balance], verbose_name='is user balance'),
),
migrations.AlterField(
model_name='paiement',
name='moyen',
field=models.CharField(max_length=255, verbose_name='method'),
),
migrations.AlterField(
model_name='vente',
name='duration',
field=models.PositiveIntegerField(blank=True, null=True, verbose_name='duration (in months)'),
),
migrations.AlterField(
model_name='vente',
name='facture',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cotisations.BaseInvoice', verbose_name='invoice'),
),
migrations.AlterField(
model_name='vente',
name='name',
field=models.CharField(max_length=255, verbose_name='article'),
),
migrations.AlterField(
model_name='vente',
name='number',
field=models.IntegerField(validators=[django.core.validators.MinValueValidator(1)], verbose_name='amount'),
),
migrations.AlterField(
model_name='vente',
name='prix',
field=models.DecimalField(decimal_places=2, max_digits=5, verbose_name='price'),
),
migrations.AlterField(
model_name='vente',
name='type_cotisation',
field=models.CharField(blank=True, choices=[('Connexion', 'Connection'), ('Adhesion', 'Membership'), ('All', 'Both of them')], max_length=255, null=True, verbose_name='subscription type'),
),
]

View file

@ -41,8 +41,7 @@ from django.dispatch import receiver
from django.forms import ValidationError
from django.core.validators import MinValueValidator
from django.utils import timezone
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy as _l
from django.utils.translation import ugettext_lazy as _
from django.urls import reverse
from django.shortcuts import redirect
from django.contrib import messages
@ -58,7 +57,7 @@ from cotisations.validators import check_no_balance
class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
date = models.DateTimeField(
auto_now_add=True,
verbose_name=_l("Date")
verbose_name=_("Date")
)
# TODO : change prix to price
@ -134,17 +133,17 @@ class Facture(BaseInvoice):
cheque = models.CharField(
max_length=255,
blank=True,
verbose_name=_l("Cheque number")
verbose_name=_("cheque number")
)
# TODO : change name to validity for clarity
valid = models.BooleanField(
default=True,
verbose_name=_l("Validated")
verbose_name=_("validated")
)
# TODO : changed name to controlled for clarity
control = models.BooleanField(
default=False,
verbose_name=_l("Controlled")
verbose_name=_("controlled")
)
class Meta:
@ -152,14 +151,14 @@ class Facture(BaseInvoice):
permissions = (
# TODO : change facture to invoice
('change_facture_control',
_l("Can change the \"controlled\" state")),
_("Can edit the \"controlled\" state")),
('view_facture',
_l("Can see an invoice's details")),
_("Can view an invoice object")),
('change_all_facture',
_l("Can edit all the previous invoices")),
_("Can edit all the previous invoices")),
)
verbose_name = _l("Invoice")
verbose_name_plural = _l("Invoices")
verbose_name = _("invoice")
verbose_name_plural = _("invoices")
def linked_objects(self):
"""Return linked objects : machine and domain.
@ -195,7 +194,7 @@ class Facture(BaseInvoice):
def can_view(self, user_request, *_args, **_kwargs):
if not user_request.has_perm('cotisations.view_facture') and \
self.user != user_request:
return False, _("You don't have the right to see someone else's "
return False, _("You don't have the right to view someone else's "
"invoices history.")
elif not self.valid:
return False, _("The invoice has been invalidated.")
@ -222,7 +221,7 @@ class Facture(BaseInvoice):
if user_request.has_perm('cotisations.add_facture'):
return True, None
if len(Paiement.find_allowed_payments(user_request)) <= 0:
return False, _("There are no payment types which you can use.")
return False, _("There are no payment method which you can use.")
if len(Article.find_allowed_articles(user_request)) <= 0:
return False, _("There are no article that you can buy.")
return True, None
@ -259,22 +258,22 @@ def facture_post_delete(**kwargs):
class CustomInvoice(BaseInvoice):
class Meta:
permissions = (
('view_custominvoice', _l("Can view a custom invoice")),
('view_custominvoice', _("Can view a custom invoice object")),
)
recipient = models.CharField(
max_length=255,
verbose_name=_l("Recipient")
verbose_name=_("Recipient")
)
payment = models.CharField(
max_length=255,
verbose_name=_l("Payment type")
verbose_name=_("Payment type")
)
address = models.CharField(
max_length=255,
verbose_name=_l("Address")
verbose_name=_("Address")
)
paid = models.BooleanField(
verbose_name="Paid"
verbose_name=_("Paid")
)
@ -294,38 +293,38 @@ class Vente(RevMixin, AclMixin, models.Model):
# TODO : change this to English
COTISATION_TYPE = (
('Connexion', _l("Connexion")),
('Adhesion', _l("Membership")),
('All', _l("Both of them")),
('Connexion', _("Connection")),
('Adhesion', _("Membership")),
('All', _("Both of them")),
)
# TODO : change facture to invoice
facture = models.ForeignKey(
'BaseInvoice',
on_delete=models.CASCADE,
verbose_name=_l("Invoice")
verbose_name=_("invoice")
)
# TODO : change number to amount for clarity
number = models.IntegerField(
validators=[MinValueValidator(1)],
verbose_name=_l("Amount")
verbose_name=_("amount")
)
# TODO : change this field for a ForeinKey to Article
name = models.CharField(
max_length=255,
verbose_name=_l("Article")
verbose_name=_("article")
)
# TODO : change prix to price
# TODO : this field is not needed if you use Article ForeignKey
prix = models.DecimalField(
max_digits=5,
decimal_places=2,
verbose_name=_l("Price"))
verbose_name=_("price"))
# TODO : this field is not needed if you use Article ForeignKey
duration = models.PositiveIntegerField(
blank=True,
null=True,
verbose_name=_l("Duration (in whole month)")
verbose_name=_("duration (in months)")
)
# TODO : this field is not needed if you use Article ForeignKey
type_cotisation = models.CharField(
@ -333,16 +332,16 @@ class Vente(RevMixin, AclMixin, models.Model):
blank=True,
null=True,
max_length=255,
verbose_name=_l("Type of cotisation")
verbose_name=_("subscription type")
)
class Meta:
permissions = (
('view_vente', _l("Can see a purchase's details")),
('change_all_vente', _l("Can edit all the previous purchases")),
('view_vente', _("Can view a purchase object")),
('change_all_vente', _("Can edit all the previous purchases")),
)
verbose_name = _l("Purchase")
verbose_name_plural = _l("Purchases")
verbose_name = _("purchase")
verbose_name_plural = _("purchases")
# TODO : change prix_total to total_price
def prix_total(self):
@ -409,7 +408,7 @@ class Vente(RevMixin, AclMixin, models.Model):
# Checking that if a cotisation is specified, there is also a duration
if self.type_cotisation and not self.duration:
raise ValidationError(
_("A cotisation should always have a duration.")
_("Duration must be specified for a subscription.")
)
self.update_cotisation()
super(Vente, self).save(*args, **kwargs)
@ -445,7 +444,7 @@ class Vente(RevMixin, AclMixin, models.Model):
def can_view(self, user_request, *_args, **_kwargs):
if (not user_request.has_perm('cotisations.view_vente') and
self.facture.user != user_request):
return False, _("You don't have the right to see someone "
return False, _("You don't have the right to view someone "
"else's purchase history.")
else:
return True, None
@ -508,38 +507,38 @@ class Article(RevMixin, AclMixin, models.Model):
# TODO : Either use TYPE or TYPES in both choices but not both
USER_TYPES = (
('Adherent', _l("Member")),
('Club', _l("Club")),
('All', _l("Both of them")),
('Adherent', _("Member")),
('Club', _("Club")),
('All', _("Both of them")),
)
COTISATION_TYPE = (
('Connexion', _l("Connexion")),
('Adhesion', _l("Membership")),
('All', _l("Both of them")),
('Connexion', _("Connection")),
('Adhesion', _("Membership")),
('All', _("Both of them")),
)
name = models.CharField(
max_length=255,
verbose_name=_l("Designation")
verbose_name=_("designation")
)
# TODO : change prix to price
prix = models.DecimalField(
max_digits=5,
decimal_places=2,
verbose_name=_l("Unitary price")
verbose_name=_("unit price")
)
duration = models.PositiveIntegerField(
blank=True,
null=True,
validators=[MinValueValidator(0)],
verbose_name=_l("Duration (in whole month)")
verbose_name=_("duration (in months)")
)
type_user = models.CharField(
choices=USER_TYPES,
default='All',
max_length=255,
verbose_name=_l("Type of users concerned")
verbose_name=_("type of users concerned")
)
type_cotisation = models.CharField(
choices=COTISATION_TYPE,
@ -547,31 +546,31 @@ class Article(RevMixin, AclMixin, models.Model):
blank=True,
null=True,
max_length=255,
verbose_name=_l("Type of cotisation")
verbose_name=_("subscription type")
)
available_for_everyone = models.BooleanField(
default=False,
verbose_name=_l("Is available for every user")
verbose_name=_("is available for every user")
)
unique_together = ('name', 'type_user')
class Meta:
permissions = (
('view_article', _l("Can see an article's details")),
('buy_every_article', _l("Can buy every_article"))
('view_article', _("Can view an article object")),
('buy_every_article', _("Can buy every article"))
)
verbose_name = "Article"
verbose_name_plural = "Articles"
verbose_name = "article"
verbose_name_plural = "articles"
def clean(self):
if self.name.lower() == 'solde':
raise ValidationError(
_("Solde is a reserved article name")
_("Balance is a reserved article name.")
)
if self.type_cotisation and not self.duration:
raise ValidationError(
_("Duration must be specified for a cotisation")
_("Duration must be specified for a subscription.")
)
def __str__(self):
@ -592,7 +591,7 @@ class Article(RevMixin, AclMixin, models.Model):
self.available_for_everyone
or user.has_perm('cotisations.buy_every_article')
or user.has_perm('cotisations.add_facture'),
_("You cannot buy this Article.")
_("You can't buy this article.")
)
@classmethod
@ -618,15 +617,14 @@ class Banque(RevMixin, AclMixin, models.Model):
name = models.CharField(
max_length=255,
verbose_name=_l("Name")
)
class Meta:
permissions = (
('view_banque', _l("Can see a bank's details")),
('view_banque', _("Can view a bank object")),
)
verbose_name = _l("Bank")
verbose_name_plural = _l("Banks")
verbose_name = _("bank")
verbose_name_plural = _("banks")
def __str__(self):
return self.name
@ -644,33 +642,33 @@ class Paiement(RevMixin, AclMixin, models.Model):
# TODO : change moyen to method
moyen = models.CharField(
max_length=255,
verbose_name=_l("Method")
verbose_name=_("method")
)
available_for_everyone = models.BooleanField(
default=False,
verbose_name=_l("Is available for every user")
verbose_name=_("is available for every user")
)
is_balance = models.BooleanField(
default=False,
editable=False,
verbose_name=_l("Is user balance"),
help_text=_l("There should be only one balance payment method."),
verbose_name=_("is user balance"),
help_text=_("There should be only one balance payment method."),
validators=[check_no_balance]
)
class Meta:
permissions = (
('view_paiement', _l("Can see a payement's details")),
('use_every_payment', _l("Can use every payement")),
('view_paiement', _("Can view a payment method object")),
('use_every_payment', _("Can use every payment method")),
)
verbose_name = _l("Payment method")
verbose_name_plural = _l("Payment methods")
verbose_name = _("payment method")
verbose_name_plural = _("payment methods")
def __str__(self):
return self.moyen
def clean(self):
"""
"""l
Override of the herited clean function to get a correct name
"""
self.moyen = self.moyen.title()
@ -698,8 +696,8 @@ class Paiement(RevMixin, AclMixin, models.Model):
if any(sell.type_cotisation for sell in invoice.vente_set.all()):
messages.success(
request,
_("The cotisation of %(member_name)s has been \
extended to %(end_date)s.") % {
_("The subscription of %(member_name)s was extended to"
" %(end_date)s.") % {
'member_name': invoice.user.pseudo,
'end_date': invoice.user.end_adhesion()
}
@ -708,7 +706,7 @@ class Paiement(RevMixin, AclMixin, models.Model):
else:
messages.success(
request,
_("The invoice has been created.")
_("The invoice was created.")
)
return redirect(reverse(
'users:profil',
@ -729,7 +727,7 @@ class Paiement(RevMixin, AclMixin, models.Model):
self.available_for_everyone
or user.has_perm('cotisations.use_every_payment')
or user.has_perm('cotisations.add_facture'),
_("You cannot use this Payment.")
_("You can't use this payment method.")
)
@classmethod
@ -747,7 +745,7 @@ class Paiement(RevMixin, AclMixin, models.Model):
p = find_payment_method(self)
if p is not None:
return p._meta.verbose_name
return _("No custom payment method")
return _("No custom payment method.")
class Cotisation(RevMixin, AclMixin, models.Model):
@ -763,9 +761,9 @@ class Cotisation(RevMixin, AclMixin, models.Model):
"""
COTISATION_TYPE = (
('Connexion', _l("Connexion")),
('Adhesion', _l("Membership")),
('All', _l("Both of them")),
('Connexion', _("Connection")),
('Adhesion', _("Membership")),
('All', _("Both of them")),
)
# TODO : change vente to purchase
@ -773,34 +771,36 @@ class Cotisation(RevMixin, AclMixin, models.Model):
'Vente',
on_delete=models.CASCADE,
null=True,
verbose_name=_l("Purchase")
verbose_name=_("purchase")
)
type_cotisation = models.CharField(
choices=COTISATION_TYPE,
max_length=255,
default='All',
verbose_name=_l("Type of cotisation")
verbose_name=_("subscription type")
)
date_start = models.DateTimeField(
verbose_name=_l("Starting date")
verbose_name=_("start date")
)
date_end = models.DateTimeField(
verbose_name=_l("Ending date")
verbose_name=_("end date")
)
class Meta:
permissions = (
('view_cotisation', _l("Can see a cotisation's details")),
('change_all_cotisation', _l("Can edit the previous cotisations")),
('view_cotisation', _("Can view a subscription object")),
('change_all_cotisation', _("Can edit the previous subscriptions")),
)
verbose_name = _("subscription")
verbose_name_plural = _("subscriptions")
def can_edit(self, user_request, *_args, **_kwargs):
if not user_request.has_perm('cotisations.change_cotisation'):
return False, _("You don't have the right to edit a cotisation.")
return False, _("You don't have the right to edit a subscription.")
elif not user_request.has_perm('cotisations.change_all_cotisation') \
and (self.vente.facture.control or
not self.vente.facture.valid):
return False, _("You don't have the right to edit a cotisation "
return False, _("You don't have the right to edit a subscription "
"already controlled or invalidated.")
else:
return True, None
@ -808,9 +808,9 @@ class Cotisation(RevMixin, AclMixin, models.Model):
def can_delete(self, user_request, *_args, **_kwargs):
if not user_request.has_perm('cotisations.delete_cotisation'):
return False, _("You don't have the right to delete a "
"cotisation.")
"subscription.")
if self.vente.facture.control or not self.vente.facture.valid:
return False, _("You don't have the right to delete a cotisation "
return False, _("You don't have the right to delete a subscription "
"already controlled or invalidated.")
else:
return True, None
@ -818,8 +818,8 @@ class Cotisation(RevMixin, AclMixin, models.Model):
def can_view(self, user_request, *_args, **_kwargs):
if not user_request.has_perm('cotisations.view_cotisation') and\
self.vente.facture.user != user_request:
return False, _("You don't have the right to see someone else's "
"cotisation history.")
return False, _("You don't have the right to view someone else's "
"subscription history.")
else:
return True, None
@ -847,3 +847,4 @@ def cotisation_post_delete(**_kwargs):
"""
regen('mac_ip_list')
regen('mailing')

View file

@ -21,8 +21,7 @@
from django.db import models
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy as _l
from django.utils.translation import ugettext_lazy as _
from django.contrib import messages
@ -36,7 +35,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
"""
class Meta:
verbose_name = _l("User Balance")
verbose_name = _("user balance")
payment = models.OneToOneField(
Paiement,
@ -45,8 +44,8 @@ class BalancePayment(PaymentMethodMixin, models.Model):
editable=False
)
minimum_balance = models.DecimalField(
verbose_name=_l("Minimum balance"),
help_text=_l("The minimal amount of money allowed for the balance"
verbose_name=_("Minimum balance"),
help_text=_("The minimal amount of money allowed for the balance"
" at the end of a payment. You can specify negative "
"amount."
),
@ -55,8 +54,8 @@ class BalancePayment(PaymentMethodMixin, models.Model):
default=0,
)
maximum_balance = models.DecimalField(
verbose_name=_l("Maximum balance"),
help_text=_l("The maximal amount of money allowed for the balance."),
verbose_name=_("Maximum balance"),
help_text=_("The maximal amount of money allowed for the balance."),
max_digits=5,
decimal_places=2,
default=50,
@ -64,7 +63,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
null=True,
)
credit_balance_allowed = models.BooleanField(
verbose_name=_l("Allow user to credit their balance"),
verbose_name=_("Allow user to credit their balance"),
default=False,
)
@ -97,7 +96,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
if len(p) > 0:
form.add_error(
'payment_method',
_("There is already a payment type for user balance")
_("There is already a payment method for user balance.")
)
def alter_payment(self, payment):
@ -118,3 +117,4 @@ class BalancePayment(PaymentMethodMixin, models.Model):
len(Paiement.find_allowed_payments(user_request)
.exclude(is_balance=True)) > 0
) and self.credit_balance_allowed

View file

@ -21,7 +21,7 @@
from django.db import models
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _l
from django.utils.translation import ugettext_lazy as _
from cotisations.models import Paiement
from cotisations.payment_methods.mixins import PaymentMethodMixin
@ -33,7 +33,7 @@ class ChequePayment(PaymentMethodMixin, models.Model):
"""
class Meta:
verbose_name = _l("Cheque")
verbose_name = _("Cheque")
payment = models.OneToOneField(
Paiement,
@ -52,3 +52,4 @@ class ChequePayment(PaymentMethodMixin, models.Model):
'cotisations:cheque:validate',
kwargs={'invoice_pk': invoice.pk}
))

View file

@ -44,7 +44,7 @@ def cheque(request, invoice_pk):
if invoice.valid or not isinstance(payment_method, ChequePayment):
messages.error(
request,
_("You cannot pay this invoice with a cheque.")
_("You can't pay this invoice with a cheque.")
)
return redirect(reverse(
'users:profil',
@ -67,3 +67,4 @@ def cheque(request, invoice_pk):
'amount': invoice.prix_total()
}
)

View file

@ -21,8 +21,7 @@
from django.db import models
from django.shortcuts import render
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy as _l
from django.utils.translation import ugettext_lazy as _
from cotisations.models import Paiement
from cotisations.payment_methods.mixins import PaymentMethodMixin
@ -37,7 +36,7 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
"""
class Meta:
verbose_name = "ComNpay"
verbose_name = _("ComNpay")
payment = models.OneToOneField(
Paiement,
@ -49,17 +48,17 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
max_length=255,
default='',
blank=True,
verbose_name=_l("ComNpay VAD Number"),
verbose_name=_("ComNpay VAT Number"),
)
payment_pass = AESEncryptedField(
max_length=255,
null=True,
blank=True,
verbose_name=_l("ComNpay Secret Key"),
verbose_name=_("ComNpay secret key"),
)
minimum_payment = models.DecimalField(
verbose_name=_l("Minimum payment"),
help_text=_l("The minimal amount of money you have to use when paying"
verbose_name=_("Minimum payment"),
help_text=_("The minimal amount of money you have to use when paying"
" with ComNpay"),
max_digits=5,
decimal_places=2,
@ -67,7 +66,7 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
)
production = models.BooleanField(
default=True,
verbose_name=_l("Production mode enabled (production url, instead of homologation)"),
verbose_name=_("Production mode enabled (production URL, instead of homologation)"),
)
def return_url_comnpay(self):
@ -102,7 +101,7 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
'action': self.return_url_comnpay(),
'method': 'POST',
'content': p.buildSecretHTML(
_("Pay invoice no : ")+str(invoice.id),
_("Pay invoice number ")+str(invoice.id),
invoice.prix_total(),
idTransaction=str(invoice.id)
),
@ -114,6 +113,6 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
"""Checks that the price meets the requirement to be paid with ComNpay.
"""
return ((price >= self.minimum_payment),
_('In order to pay your invoice with ComNpay'
', the price must be grater than {}')
.format(self.minimum_payment))
_("In order to pay your invoice with ComNpay, the price must"
" be greater than {} €.").format(self.minimum_payment))

View file

@ -50,7 +50,7 @@ def accept_payment(request, factureid):
if invoice.valid:
messages.success(
request,
_("The payment of %(amount)shas been accepted.") % {
_("The payment of %(amount)swas accepted.") % {
'amount': invoice.prix_total()
}
)
@ -60,8 +60,8 @@ def accept_payment(request, factureid):
for purchase in invoice.vente_set.all()):
messages.success(
request,
_("The cotisation of %(member_name)s has been \
extended to %(end_date)s.") % {
_("The subscription of %(member_name)s was extended to"
" %(end_date)s.") % {
'member_name': request.user.pseudo,
'end_date': request.user.end_adhesion()
}
@ -81,7 +81,7 @@ def refuse_payment(request):
"""
messages.error(
request,
_("The payment has been refused.")
_("The payment was refused.")
)
return redirect(reverse(
'users:profil',
@ -136,3 +136,4 @@ def ipn(request):
# Everything worked we send a reponse to Comnpay indicating that
# it's ok for them to proceed
return HttpResponse("HTTP/1.0 200 OK")

View file

@ -19,8 +19,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from django import forms
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy as _l
from django.utils.translation import ugettext_lazy as _
from . import PAYMENT_METHODS
from cotisations.utils import find_payment_method
@ -58,8 +57,8 @@ class PaymentMethodForm(forms.Form):
"""
payment_method = forms.ChoiceField(
label=_l("Special payment method"),
help_text=_l("Warning : You will not be able to change the payment "
label=_("Special payment method"),
help_text=_("Warning: you will not be able to change the payment "
"method later. But you will be allowed to edit the other "
"options."
),
@ -70,7 +69,7 @@ class PaymentMethodForm(forms.Form):
super(PaymentMethodForm, self).__init__(*args, **kwargs)
prefix = kwargs.get('prefix', None)
self.fields['payment_method'].choices = [(i,p.NAME) for (i,p) in enumerate(PAYMENT_METHODS)]
self.fields['payment_method'].choices.insert(0, ('', _l('no')))
self.fields['payment_method'].choices.insert(0, ('', _('no')))
self.fields['payment_method'].widget.attrs = {
'id': 'paymentMethodSelect'
}

View file

@ -32,8 +32,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<th>{% trans "Article" %}</th>
<th>{% trans "Price" %}</th>
<th>{% trans "Cotisation type" %}</th>
<th>{% trans "Duration (month)" %}</th>
<th>{% trans "Subscription type" %}</th>
<th>{% trans "Duration (in months)" %}</th>
<th>{% trans "Concerned users" %}</th>
<th>{% trans "Available for everyone" %}</th>
<th></th>

View file

@ -26,25 +26,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load i18n %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Bank" %}</th>
<th></th>
</tr>
</thead>
{% for banque in banque_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ banque.name }}</td>
<td class="text-right">
{% can_edit banque %}
<a class="btn btn-primary btn-sm" role="button" title="{% trans "Edit" %}" href="{% url 'cotisations:edit-banque' banque.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% history_button banque %}
</td>
<th>{% trans "Bank" %}</th>
<th></th>
</tr>
{% endfor %}
</table>
</thead>
{% for banque in banque_list %}
<tr>
<td>{{ banque.name }}</td>
<td class="text-right">
{% can_edit banque %}
{% include 'buttons/edit.html' with href='cotisations:edit-banque' id=banque.id %}
{% acl_end %}
{% history_button banque %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -49,7 +49,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include 'buttons/sort.html' with prefix='cotis' col='date' text=tr_date %}
</th>
<th>
{% trans "Invoice id" as tr_invoice_id %}
{% trans "Invoice ID" as tr_invoice_id %}
{% include 'buttons/sort.html' with prefix='cotis' col='id' text=tr_invoice_id %}
</th>
<th></th>
@ -65,32 +65,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ facture.date }}</td>
<td>{{ facture.id }}</td>
<td>
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="editinvoice" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{% trans "Edit" %}<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="editinvoice">
{% can_edit facture %}
<li>
<a href="{% url 'cotisations:edit-facture' facture.id %}">
<i class="fa fa-dollar-sign"></i> {% trans "Edit" %}
</a>
</li>
{% acl_else %}
<li>{% trans "Controlled invoice" %}</li>
{% acl_end %}
{% can_delete facture %}
<li>
<a href="{% url 'cotisations:del-facture' facture.id %}">
<i class="fa fa-trash"></i> {% trans "Delete" %}
</a>
</li>
{% acl_end %}
<li>
{% history_button facture text=True html_class=False%}
</li>
</ul>
</div>
{% can_edit facture %}
{% include 'buttons/edit.html' with href='cotisations:edit-facture' id=facture.id %}
{% acl_else %}
{% trans "Controlled invoice" %}
{% acl_end %}
{% can_delete facture %}
{% include 'buttons/suppr.html' with href='cotisations:del-facture' id=facture.id %}
{% acl_end %}
{% history_button facture text=True html_class=False %}
</td>
<td>
{% if facture.valid %}
@ -109,3 +92,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include 'pagination.html' with list=facture_list %}
{% endif %}
</div>

View file

@ -47,7 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include 'buttons/sort.html' with prefix='invoice' col='date' text=tr_date %}
</th>
<th>
{% trans "Invoice id" as tr_invoice_id %}
{% trans "Invoice ID" as tr_invoice_id %}
{% include 'buttons/sort.html' with prefix='invoice' col='id' text=tr_invoice_id %}
</th>
<th>

View file

@ -41,7 +41,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ paiement.moyen }}</td>
<td>{{ paiement.available_for_everyone|tick }}</td>
<td>
{{paiement.get_payment_method_name}}
{{ paiement.get_payment_method_name }}
</td>
<td class="text-right">
{% can_edit paiement %}

View file

@ -30,17 +30,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Invoice control" %}{% endblock %}
{% block content %}
<h2>{% trans "Invoice control and validation" %}</h2>
{% if facture_list.paginator %}
{% include 'pagination.html' with list=facture_list %}
{% endif %}
<form class="form" method="post">
{% csrf_token %}
{{ controlform.management_form }}
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Profil" %}</th>
<th>{% trans "Profile" %}</th>
<th>
{% trans "Last name" as tr_last_name %}
{% include 'buttons/sort.html' with prefix='control' col='name' text=tr_last_name %}
@ -50,11 +53,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include 'buttons/sort.html' with prefix='control' col='surname' text=tr_first_name %}
</th>
<th>
{% trans "Invoice id" as tr_invoice_id %}
{% trans "Invoice ID" as tr_invoice_id %}
{% include 'buttons/sort.html' with prefix='control' col='id' text=tr_invoice_id %}
</th>
<th>
{% trans "User id" as tr_user_id %}
{% trans "User ID" as tr_user_id %}
{% include 'buttons/sort.html' with prefix='control' col='user-id' text=tr_user_id %}
</th>
<th>{% trans "Designation" %}</th>
@ -65,7 +68,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</th>
<th>
{% trans "Date" as tr_date %}
{% include 'buttons/sort.html' with prefix='control' col='date' text=tr_date %}i
{% include 'buttons/sort.html' with prefix='control' col='date' text=tr_date %}
</th>
<th>
{% trans "Validated" as tr_validated %}
@ -109,3 +112,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% if facture_list.paginator %}
{% include 'pagination.html' with list=facture_list %}
{% endif %}

View file

@ -26,18 +26,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load bootstrap3 %}
{% load i18n %}
{% block title %}{% trans "Deletion of cotisations" %}{% endblock %}
{% block title %}{% trans "Deletion of subscriptions" %}{% endblock %}
{% block content %}
<form class="form" method="post">
{% csrf_token %}
<h4>
{% blocktrans %}
Warning. Are you sure you really want te delete this {{ object_name }} object ( {{ objet }} ) ?
{% endblocktrans %}
{% blocktrans %}Warning: are you sure you really want to delete this {{ object_name }} object ( {{ objet }} )?{% endblocktrans %}
</h4>
{% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_confirm button_type='submit' icon='trash' %}
</form>
{% endblock %}

View file

@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load massive_bootstrap_form %}
{% load i18n %}
{% block title %}{% trans "Invoices creation and edition" %}{% endblock %}
{% block title %}{% trans "Creation and editing of invoices" %}{% endblock %}
{% block content %}
{% bootstrap_form_errors factureform %}
@ -62,3 +62,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</form>
{% endblock %}

View file

@ -27,20 +27,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load staticfiles%}
{% load i18n %}
{% block title %}{% trans "Invoices creation and edition" %}{% endblock %}
{% block title %}{% trans "Creation and editing of invoices" %}{% endblock %}
{% block content %}
{% if title %}
<h3>{{title}}</h3>
<h3>{{ title }}</h3>
{% else %}
<h3>{% trans "New invoice" %}</h3>
{% endif %}
{% if max_balance %}
<h4>{% trans "Maximum allowed balance : "%}{{max_balance}} €</h4>
<h4>{% blocktrans %}Maximum allowed balance: {{ max_balance }} €{% endblocktrans %}</h4>
{% endif %}
{% if balance is not None %}
<p>
{% trans "Current balance :" %} {{ balance }} €
{% blocktrans %}Current balance: {{ balance }} €{% endblocktrans %}
</p>
{% endif %}
@ -68,9 +69,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
<input class="btn btn-primary btn-sm" role="button" value="{% trans "Add an article"%}" id="add_one">
<p>
{% blocktrans %}
Total price : <span id="total_price">0,00</span>
{% endblocktrans %}
{% blocktrans %}Total price: <span id="total_price">0,00</span> €{% endblocktrans %}
</p>
{% endif %}
{% bootstrap_button action_name button_type='submit' icon='star' %}
@ -183,3 +182,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endif %}
{% endblock %}

View file

@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Invoices" %}{% endblock %}
{% block content %}
<h2>{% trans "Cotisations" %}</h2>
<h2>{% trans "Subscriptions" %}</h2>
{% include 'cotisations/aff_cotisations.html' with facture_list=facture_list %}
{% endblock %}

View file

@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</a>
{% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-article' %}">
<i class="fa fa-trash"></i> {% trans "Delete article types" %}
<i class="fa fa-trash"></i> {% trans "Delete one or several article types" %}
</a>
{% include 'cotisations/aff_article.html' with article_list=article_list %}
{% endblock %}

View file

@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</a>
{% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-banque' %}">
<i class="fa fa-trash"></i> {% trans "Delete banks" %}
<i class="fa fa-trash"></i> {% trans "Delete one or several banks" %}
</a>
{% include 'cotisations/aff_banque.html' with banque_list=banque_list %}
{% endblock %}

View file

@ -27,17 +27,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load i18n %}
{% block title %}{% trans "Payments" %}{% endblock %}
{% block title %}{% trans "Payment methods" %}{% endblock %}
{% block content %}
<h2>{% trans "Payment types list" %}</h2>
<h2>{% trans "List of payment methods" %}</h2>
{% can_create 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 type" %}
<i class="fa fa-cart-plus"></i> {% trans "Add a payment method" %}
</a>
{% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-paiement' %}">
<i class="fa fa-trash"></i> {% trans "Delete payment types" %}
<i class="fa fa-trash"></i> {% trans "Delete one or several payment methods" %}
</a>
{% include 'cotisations/aff_paiement.html' with paiement_list=paiement_list %}
{% endblock %}

View file

@ -31,11 +31,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %}
<h3>
{% blocktrans %}
Pay {{ amount }} €
{% endblocktrans %}
{% blocktrans %}Pay {{ amount }} €{% endblocktrans %}
</h3>
<form class="form" method="{{ method | default:"post" }}" action="{{ action }}">
<form class="form" method="{{ method|default:"post" }}" action="{{ action }}">
{{ content | safe }}
{% if form %}
{% csrf_token %}
@ -45,3 +43,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% bootstrap_button tr_pay button_type='submit' icon='piggy-bank' %}
</form>
{% endblock %}

View file

@ -61,3 +61,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</a>
{% acl_end %}
{% endblock %}

View file

@ -17,5 +17,6 @@ def check_no_balance(is_balance):
p = Paiement.objects.filter(is_balance=True)
if len(p) > 0:
raise ValidationError(
_("There are already payment method(s) for user balance")
_("There is already a payment method for user balance.")
)

View file

@ -225,7 +225,7 @@ def new_custom_invoice(request):
)
messages.success(
request,
_('The custom invoice was successfully created.')
_("The custom invoice was created.")
)
return redirect(reverse('cotisations:index-custom-invoice'))
@ -313,7 +313,7 @@ def edit_facture(request, facture, **_kwargs):
purchase_form.save()
messages.success(
request,
_("The invoice has been successfully edited.")
_("The invoice was edited.")
)
return redirect(reverse('cotisations:index'))
return form({
@ -333,7 +333,7 @@ def del_facture(request, facture, **_kwargs):
facture.delete()
messages.success(
request,
_("The invoice has been successfully deleted.")
_("The invoice was deleted.")
)
return redirect(reverse('cotisations:index'))
return form({
@ -367,7 +367,7 @@ def edit_custom_invoice(request, invoice, **kwargs):
purchase_form.save()
messages.success(
request,
_("The invoice has been successfully edited.")
_("The invoice was edited.")
)
return redirect(reverse('cotisations:index-custom-invoice'))
@ -427,7 +427,7 @@ def del_custom_invoice(request, invoice, **_kwargs):
invoice.delete()
messages.success(
request,
_("The invoice has been successfully deleted.")
_("The invoice was deleted.")
)
return redirect(reverse('cotisations:index-custom-invoice'))
return form({
@ -453,7 +453,7 @@ def add_article(request):
article.save()
messages.success(
request,
_("The article has been successfully created.")
_("The article was created.")
)
return redirect(reverse('cotisations:index-article'))
return form({
@ -475,7 +475,7 @@ def edit_article(request, article_instance, **_kwargs):
article.save()
messages.success(
request,
_("The article has been successfully edited.")
_("The article was edited.")
)
return redirect(reverse('cotisations:index-article'))
return form({
@ -497,7 +497,7 @@ def del_article(request, instances):
article_del.delete()
messages.success(
request,
_("The article(s) have been successfully deleted.")
_("The articles were deleted.")
)
return redirect(reverse('cotisations:index-article'))
return form({
@ -525,7 +525,7 @@ def add_paiement(request):
payment_method.save(payment)
messages.success(
request,
_("The payment method has been successfully created.")
_("The payment method was created.")
)
return redirect(reverse('cotisations:index-paiement'))
return form({
@ -561,8 +561,7 @@ def edit_paiement(request, paiement_instance, **_kwargs):
if payment_method is not None:
payment_method.save()
messages.success(
request,
_("The payement method has been successfully edited.")
request,_("The payment method was edited.")
)
return redirect(reverse('cotisations:index-paiement'))
return form({
@ -588,8 +587,7 @@ def del_paiement(request, instances):
payment_del.delete()
messages.success(
request,
_("The payment method %(method_name)s has been \
successfully deleted.") % {
_("The payment method %(method_name)s was deleted.") % {
'method_name': payment_del
}
)
@ -621,7 +619,7 @@ def add_banque(request):
bank.save()
messages.success(
request,
_("The bank has been successfully created.")
_("The bank was created.")
)
return redirect(reverse('cotisations:index-banque'))
return form({
@ -644,7 +642,7 @@ def edit_banque(request, banque_instance, **_kwargs):
bank.save()
messages.success(
request,
_("The bank has been successfully edited")
_("The bank was edited.")
)
return redirect(reverse('cotisations:index-banque'))
return form({
@ -669,8 +667,7 @@ def del_banque(request, instances):
bank_del.delete()
messages.success(
request,
_("The bank %(bank_name)s has been successfully \
deleted.") % {
_("The bank %(bank_name)s was deleted.") % {
'bank_name': bank_del
}
)
@ -873,3 +870,4 @@ def credit_solde(request, user, **_kwargs):
'action_name': _("Pay"),
'max_balance': p.payment_method.maximum_balance,
}, 'cotisations/facture.html', request)