mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 22:22:26 +00:00
Translation of cotisations/ (front)
This commit is contained in:
parent
0193f474a0
commit
a06082c6d4
29 changed files with 923 additions and 636 deletions
|
@ -42,4 +42,5 @@ def can_view(user):
|
||||||
if can:
|
if can:
|
||||||
return can, None
|
return can, None
|
||||||
else:
|
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.")
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@ from django import forms
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.forms import ModelForm, Form
|
from django.forms import ModelForm, Form
|
||||||
from django.core.validators import MinValueValidator
|
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 django.shortcuts import get_object_or_404
|
||||||
|
|
||||||
from re2o.field_permissions import FieldPermissionFormMixin
|
from re2o.field_permissions import FieldPermissionFormMixin
|
||||||
|
@ -93,11 +93,11 @@ class SelectUserArticleForm(FormRevMixin, Form):
|
||||||
queryset=Article.objects.filter(
|
queryset=Article.objects.filter(
|
||||||
Q(type_user='All') | Q(type_user='Adherent')
|
Q(type_user='All') | Q(type_user='Adherent')
|
||||||
),
|
),
|
||||||
label=_l("Article"),
|
label=_("Article"),
|
||||||
required=True
|
required=True
|
||||||
)
|
)
|
||||||
quantity = forms.IntegerField(
|
quantity = forms.IntegerField(
|
||||||
label=_l("Quantity"),
|
label=_("Quantity"),
|
||||||
validators=[MinValueValidator(1)],
|
validators=[MinValueValidator(1)],
|
||||||
required=True
|
required=True
|
||||||
)
|
)
|
||||||
|
@ -117,11 +117,11 @@ class SelectClubArticleForm(Form):
|
||||||
queryset=Article.objects.filter(
|
queryset=Article.objects.filter(
|
||||||
Q(type_user='All') | Q(type_user='Club')
|
Q(type_user='All') | Q(type_user='Club')
|
||||||
),
|
),
|
||||||
label=_l("Article"),
|
label=_("Article"),
|
||||||
required=True
|
required=True
|
||||||
)
|
)
|
||||||
quantity = forms.IntegerField(
|
quantity = forms.IntegerField(
|
||||||
label=_l("Quantity"),
|
label=_("Quantity"),
|
||||||
validators=[MinValueValidator(1)],
|
validators=[MinValueValidator(1)],
|
||||||
required=True
|
required=True
|
||||||
)
|
)
|
||||||
|
@ -161,7 +161,7 @@ class DelArticleForm(FormRevMixin, Form):
|
||||||
"""
|
"""
|
||||||
articles = forms.ModelMultipleChoiceField(
|
articles = forms.ModelMultipleChoiceField(
|
||||||
queryset=Article.objects.none(),
|
queryset=Article.objects.none(),
|
||||||
label=_l("Existing articles"),
|
label=_("Available articles"),
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -201,7 +201,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=_l("Existing payment method"),
|
label=_("Available payment methods"),
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -239,7 +239,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=_l("Existing banks"),
|
label=_("Available banks"),
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -258,13 +258,13 @@ class RechargeForm(FormRevMixin, Form):
|
||||||
Form used to refill a user's balance
|
Form used to refill a user's balance
|
||||||
"""
|
"""
|
||||||
value = forms.FloatField(
|
value = forms.FloatField(
|
||||||
label=_l("Amount"),
|
label=_("Amount"),
|
||||||
min_value=0.01,
|
min_value=0.01,
|
||||||
validators=[]
|
validators=[]
|
||||||
)
|
)
|
||||||
payment = forms.ModelChoiceField(
|
payment = forms.ModelChoiceField(
|
||||||
queryset=Paiement.objects.none(),
|
queryset=Paiement.objects.none(),
|
||||||
label=_l("Payment method")
|
label=_("Payment method")
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, *args, user=None, **kwargs):
|
def __init__(self, *args, user=None, **kwargs):
|
||||||
|
@ -290,3 +290,4 @@ class RechargeForm(FormRevMixin, Form):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return self.cleaned_data
|
return self.cleaned_data
|
||||||
|
|
||||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load diff
181
cotisations/migrations/0033_auto_20180818_1319.py
Normal file
181
cotisations/migrations/0033_auto_20180818_1319.py
Normal 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'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -41,8 +41,7 @@ from django.dispatch import receiver
|
||||||
from django.forms import ValidationError
|
from django.forms import ValidationError
|
||||||
from django.core.validators import MinValueValidator
|
from django.core.validators import MinValueValidator
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ugettext_lazy as _l
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
@ -58,7 +57,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(
|
date = models.DateTimeField(
|
||||||
auto_now_add=True,
|
auto_now_add=True,
|
||||||
verbose_name=_l("Date")
|
verbose_name=_("Date")
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO : change prix to price
|
# TODO : change prix to price
|
||||||
|
@ -134,17 +133,17 @@ class Facture(BaseInvoice):
|
||||||
cheque = models.CharField(
|
cheque = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
blank=True,
|
blank=True,
|
||||||
verbose_name=_l("Cheque number")
|
verbose_name=_("cheque number")
|
||||||
)
|
)
|
||||||
# TODO : change name to validity for clarity
|
# TODO : change name to validity for clarity
|
||||||
valid = models.BooleanField(
|
valid = models.BooleanField(
|
||||||
default=True,
|
default=True,
|
||||||
verbose_name=_l("Validated")
|
verbose_name=_("validated")
|
||||||
)
|
)
|
||||||
# TODO : changed name to controlled for clarity
|
# TODO : changed name to controlled for clarity
|
||||||
control = models.BooleanField(
|
control = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
verbose_name=_l("Controlled")
|
verbose_name=_("controlled")
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -152,14 +151,14 @@ class Facture(BaseInvoice):
|
||||||
permissions = (
|
permissions = (
|
||||||
# TODO : change facture to invoice
|
# TODO : change facture to invoice
|
||||||
('change_facture_control',
|
('change_facture_control',
|
||||||
_l("Can change the \"controlled\" state")),
|
_("Can edit the \"controlled\" state")),
|
||||||
('view_facture',
|
('view_facture',
|
||||||
_l("Can see an invoice's details")),
|
_("Can view an invoice object")),
|
||||||
('change_all_facture',
|
('change_all_facture',
|
||||||
_l("Can edit all the previous invoices")),
|
_("Can edit all the previous invoices")),
|
||||||
)
|
)
|
||||||
verbose_name = _l("Invoice")
|
verbose_name = _("invoice")
|
||||||
verbose_name_plural = _l("Invoices")
|
verbose_name_plural = _("invoices")
|
||||||
|
|
||||||
def linked_objects(self):
|
def linked_objects(self):
|
||||||
"""Return linked objects : machine and domain.
|
"""Return linked objects : machine and domain.
|
||||||
|
@ -195,7 +194,7 @@ class Facture(BaseInvoice):
|
||||||
def can_view(self, user_request, *_args, **_kwargs):
|
def can_view(self, user_request, *_args, **_kwargs):
|
||||||
if not user_request.has_perm('cotisations.view_facture') and \
|
if not user_request.has_perm('cotisations.view_facture') and \
|
||||||
self.user != user_request:
|
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.")
|
"invoices history.")
|
||||||
elif not self.valid:
|
elif not self.valid:
|
||||||
return False, _("The invoice has been invalidated.")
|
return False, _("The invoice has been invalidated.")
|
||||||
|
@ -222,7 +221,7 @@ class Facture(BaseInvoice):
|
||||||
if user_request.has_perm('cotisations.add_facture'):
|
if user_request.has_perm('cotisations.add_facture'):
|
||||||
return True, None
|
return True, None
|
||||||
if len(Paiement.find_allowed_payments(user_request)) <= 0:
|
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:
|
if len(Article.find_allowed_articles(user_request)) <= 0:
|
||||||
return False, _("There are no article that you can buy.")
|
return False, _("There are no article that you can buy.")
|
||||||
return True, None
|
return True, None
|
||||||
|
@ -259,22 +258,22 @@ def facture_post_delete(**kwargs):
|
||||||
class CustomInvoice(BaseInvoice):
|
class CustomInvoice(BaseInvoice):
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
('view_custominvoice', _l("Can view a custom invoice")),
|
('view_custominvoice', _("Can view a custom invoice object")),
|
||||||
)
|
)
|
||||||
recipient = models.CharField(
|
recipient = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_l("Recipient")
|
verbose_name=_("Recipient")
|
||||||
)
|
)
|
||||||
payment = models.CharField(
|
payment = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_l("Payment type")
|
verbose_name=_("Payment type")
|
||||||
)
|
)
|
||||||
address = models.CharField(
|
address = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_l("Address")
|
verbose_name=_("Address")
|
||||||
)
|
)
|
||||||
paid = models.BooleanField(
|
paid = models.BooleanField(
|
||||||
verbose_name="Paid"
|
verbose_name=_("Paid")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -294,38 +293,38 @@ class Vente(RevMixin, AclMixin, models.Model):
|
||||||
|
|
||||||
# TODO : change this to English
|
# TODO : change this to English
|
||||||
COTISATION_TYPE = (
|
COTISATION_TYPE = (
|
||||||
('Connexion', _l("Connexion")),
|
('Connexion', _("Connection")),
|
||||||
('Adhesion', _l("Membership")),
|
('Adhesion', _("Membership")),
|
||||||
('All', _l("Both of them")),
|
('All', _("Both of them")),
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO : change facture to invoice
|
# TODO : change facture to invoice
|
||||||
facture = models.ForeignKey(
|
facture = models.ForeignKey(
|
||||||
'BaseInvoice',
|
'BaseInvoice',
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
verbose_name=_l("Invoice")
|
verbose_name=_("invoice")
|
||||||
)
|
)
|
||||||
# TODO : change number to amount for clarity
|
# TODO : change number to amount for clarity
|
||||||
number = models.IntegerField(
|
number = models.IntegerField(
|
||||||
validators=[MinValueValidator(1)],
|
validators=[MinValueValidator(1)],
|
||||||
verbose_name=_l("Amount")
|
verbose_name=_("amount")
|
||||||
)
|
)
|
||||||
# TODO : change this field for a ForeinKey to Article
|
# TODO : change this field for a ForeinKey to Article
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_l("Article")
|
verbose_name=_("article")
|
||||||
)
|
)
|
||||||
# TODO : change prix to price
|
# TODO : change prix to price
|
||||||
# TODO : this field is not needed if you use Article ForeignKey
|
# TODO : this field is not needed if you use Article ForeignKey
|
||||||
prix = models.DecimalField(
|
prix = models.DecimalField(
|
||||||
max_digits=5,
|
max_digits=5,
|
||||||
decimal_places=2,
|
decimal_places=2,
|
||||||
verbose_name=_l("Price"))
|
verbose_name=_("price"))
|
||||||
# TODO : this field is not needed if you use Article ForeignKey
|
# TODO : this field is not needed if you use Article ForeignKey
|
||||||
duration = models.PositiveIntegerField(
|
duration = models.PositiveIntegerField(
|
||||||
blank=True,
|
blank=True,
|
||||||
null=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
|
# TODO : this field is not needed if you use Article ForeignKey
|
||||||
type_cotisation = models.CharField(
|
type_cotisation = models.CharField(
|
||||||
|
@ -333,16 +332,16 @@ class Vente(RevMixin, AclMixin, models.Model):
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_l("Type of cotisation")
|
verbose_name=_("subscription type")
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
('view_vente', _l("Can see a purchase's details")),
|
('view_vente', _("Can view a purchase object")),
|
||||||
('change_all_vente', _l("Can edit all the previous purchases")),
|
('change_all_vente', _("Can edit all the previous purchases")),
|
||||||
)
|
)
|
||||||
verbose_name = _l("Purchase")
|
verbose_name = _("purchase")
|
||||||
verbose_name_plural = _l("Purchases")
|
verbose_name_plural = _("purchases")
|
||||||
|
|
||||||
# TODO : change prix_total to total_price
|
# TODO : change prix_total to total_price
|
||||||
def prix_total(self):
|
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
|
# Checking that if a cotisation is specified, there is also a duration
|
||||||
if self.type_cotisation and not self.duration:
|
if self.type_cotisation and not self.duration:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_("A cotisation should always have a duration.")
|
_("Duration must be specified for a subscription.")
|
||||||
)
|
)
|
||||||
self.update_cotisation()
|
self.update_cotisation()
|
||||||
super(Vente, self).save(*args, **kwargs)
|
super(Vente, self).save(*args, **kwargs)
|
||||||
|
@ -445,7 +444,7 @@ class Vente(RevMixin, AclMixin, models.Model):
|
||||||
def can_view(self, user_request, *_args, **_kwargs):
|
def can_view(self, user_request, *_args, **_kwargs):
|
||||||
if (not user_request.has_perm('cotisations.view_vente') and
|
if (not user_request.has_perm('cotisations.view_vente') and
|
||||||
self.facture.user != user_request):
|
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's purchase history.")
|
||||||
else:
|
else:
|
||||||
return True, None
|
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
|
# TODO : Either use TYPE or TYPES in both choices but not both
|
||||||
USER_TYPES = (
|
USER_TYPES = (
|
||||||
('Adherent', _l("Member")),
|
('Adherent', _("Member")),
|
||||||
('Club', _l("Club")),
|
('Club', _("Club")),
|
||||||
('All', _l("Both of them")),
|
('All', _("Both of them")),
|
||||||
)
|
)
|
||||||
|
|
||||||
COTISATION_TYPE = (
|
COTISATION_TYPE = (
|
||||||
('Connexion', _l("Connexion")),
|
('Connexion', _("Connection")),
|
||||||
('Adhesion', _l("Membership")),
|
('Adhesion', _("Membership")),
|
||||||
('All', _l("Both of them")),
|
('All', _("Both of them")),
|
||||||
)
|
)
|
||||||
|
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_l("Designation")
|
verbose_name=_("designation")
|
||||||
)
|
)
|
||||||
# TODO : change prix to price
|
# TODO : change prix to price
|
||||||
prix = models.DecimalField(
|
prix = models.DecimalField(
|
||||||
max_digits=5,
|
max_digits=5,
|
||||||
decimal_places=2,
|
decimal_places=2,
|
||||||
verbose_name=_l("Unitary price")
|
verbose_name=_("unit price")
|
||||||
)
|
)
|
||||||
duration = models.PositiveIntegerField(
|
duration = models.PositiveIntegerField(
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
validators=[MinValueValidator(0)],
|
validators=[MinValueValidator(0)],
|
||||||
verbose_name=_l("Duration (in whole month)")
|
verbose_name=_("duration (in months)")
|
||||||
)
|
)
|
||||||
type_user = models.CharField(
|
type_user = models.CharField(
|
||||||
choices=USER_TYPES,
|
choices=USER_TYPES,
|
||||||
default='All',
|
default='All',
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_l("Type of users concerned")
|
verbose_name=_("type of users concerned")
|
||||||
)
|
)
|
||||||
type_cotisation = models.CharField(
|
type_cotisation = models.CharField(
|
||||||
choices=COTISATION_TYPE,
|
choices=COTISATION_TYPE,
|
||||||
|
@ -547,31 +546,31 @@ class Article(RevMixin, AclMixin, models.Model):
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_l("Type of cotisation")
|
verbose_name=_("subscription type")
|
||||||
)
|
)
|
||||||
available_for_everyone = models.BooleanField(
|
available_for_everyone = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
verbose_name=_l("Is available for every user")
|
verbose_name=_("is available for every user")
|
||||||
)
|
)
|
||||||
|
|
||||||
unique_together = ('name', 'type_user')
|
unique_together = ('name', 'type_user')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
('view_article', _l("Can see an article's details")),
|
('view_article', _("Can view an article object")),
|
||||||
('buy_every_article', _l("Can buy every_article"))
|
('buy_every_article', _("Can buy every article"))
|
||||||
)
|
)
|
||||||
verbose_name = "Article"
|
verbose_name = "article"
|
||||||
verbose_name_plural = "Articles"
|
verbose_name_plural = "articles"
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if self.name.lower() == 'solde':
|
if self.name.lower() == 'solde':
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_("Solde is a reserved article name")
|
_("Balance is a reserved article name.")
|
||||||
)
|
)
|
||||||
if self.type_cotisation and not self.duration:
|
if self.type_cotisation and not self.duration:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_("Duration must be specified for a cotisation")
|
_("Duration must be specified for a subscription.")
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -592,7 +591,7 @@ class Article(RevMixin, AclMixin, models.Model):
|
||||||
self.available_for_everyone
|
self.available_for_everyone
|
||||||
or user.has_perm('cotisations.buy_every_article')
|
or user.has_perm('cotisations.buy_every_article')
|
||||||
or user.has_perm('cotisations.add_facture'),
|
or user.has_perm('cotisations.add_facture'),
|
||||||
_("You cannot buy this Article.")
|
_("You can't buy this article.")
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -618,15 +617,14 @@ class Banque(RevMixin, AclMixin, models.Model):
|
||||||
|
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_l("Name")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
('view_banque', _l("Can see a bank's details")),
|
('view_banque', _("Can view a bank object")),
|
||||||
)
|
)
|
||||||
verbose_name = _l("Bank")
|
verbose_name = _("bank")
|
||||||
verbose_name_plural = _l("Banks")
|
verbose_name_plural = _("banks")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -644,33 +642,33 @@ class Paiement(RevMixin, AclMixin, models.Model):
|
||||||
# TODO : change moyen to method
|
# TODO : change moyen to method
|
||||||
moyen = models.CharField(
|
moyen = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
verbose_name=_l("Method")
|
verbose_name=_("method")
|
||||||
)
|
)
|
||||||
available_for_everyone = models.BooleanField(
|
available_for_everyone = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
verbose_name=_l("Is available for every user")
|
verbose_name=_("is available for every user")
|
||||||
)
|
)
|
||||||
is_balance = models.BooleanField(
|
is_balance = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
editable=False,
|
editable=False,
|
||||||
verbose_name=_l("Is user balance"),
|
verbose_name=_("is user balance"),
|
||||||
help_text=_l("There should be only one balance payment method."),
|
help_text=_("There should be only one balance payment method."),
|
||||||
validators=[check_no_balance]
|
validators=[check_no_balance]
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
('view_paiement', _l("Can see a payement's details")),
|
('view_paiement', _("Can view a payment method object")),
|
||||||
('use_every_payment', _l("Can use every payement")),
|
('use_every_payment', _("Can use every payment method")),
|
||||||
)
|
)
|
||||||
verbose_name = _l("Payment method")
|
verbose_name = _("payment method")
|
||||||
verbose_name_plural = _l("Payment methods")
|
verbose_name_plural = _("payment methods")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.moyen
|
return self.moyen
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
"""
|
"""l
|
||||||
Override of the herited clean function to get a correct name
|
Override of the herited clean function to get a correct name
|
||||||
"""
|
"""
|
||||||
self.moyen = self.moyen.title()
|
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()):
|
if any(sell.type_cotisation for sell in invoice.vente_set.all()):
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The cotisation of %(member_name)s has been \
|
_("The subscription of %(member_name)s was extended to"
|
||||||
extended to %(end_date)s.") % {
|
" %(end_date)s.") % {
|
||||||
'member_name': invoice.user.pseudo,
|
'member_name': invoice.user.pseudo,
|
||||||
'end_date': invoice.user.end_adhesion()
|
'end_date': invoice.user.end_adhesion()
|
||||||
}
|
}
|
||||||
|
@ -708,7 +706,7 @@ class Paiement(RevMixin, AclMixin, models.Model):
|
||||||
else:
|
else:
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The invoice has been created.")
|
_("The invoice was created.")
|
||||||
)
|
)
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
|
@ -729,7 +727,7 @@ class Paiement(RevMixin, AclMixin, models.Model):
|
||||||
self.available_for_everyone
|
self.available_for_everyone
|
||||||
or user.has_perm('cotisations.use_every_payment')
|
or user.has_perm('cotisations.use_every_payment')
|
||||||
or user.has_perm('cotisations.add_facture'),
|
or user.has_perm('cotisations.add_facture'),
|
||||||
_("You cannot use this Payment.")
|
_("You can't use this payment method.")
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -747,7 +745,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 method.")
|
||||||
|
|
||||||
|
|
||||||
class Cotisation(RevMixin, AclMixin, models.Model):
|
class Cotisation(RevMixin, AclMixin, models.Model):
|
||||||
|
@ -763,9 +761,9 @@ class Cotisation(RevMixin, AclMixin, models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
COTISATION_TYPE = (
|
COTISATION_TYPE = (
|
||||||
('Connexion', _l("Connexion")),
|
('Connexion', _("Connection")),
|
||||||
('Adhesion', _l("Membership")),
|
('Adhesion', _("Membership")),
|
||||||
('All', _l("Both of them")),
|
('All', _("Both of them")),
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO : change vente to purchase
|
# TODO : change vente to purchase
|
||||||
|
@ -773,34 +771,36 @@ class Cotisation(RevMixin, AclMixin, models.Model):
|
||||||
'Vente',
|
'Vente',
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
null=True,
|
null=True,
|
||||||
verbose_name=_l("Purchase")
|
verbose_name=_("purchase")
|
||||||
)
|
)
|
||||||
type_cotisation = models.CharField(
|
type_cotisation = models.CharField(
|
||||||
choices=COTISATION_TYPE,
|
choices=COTISATION_TYPE,
|
||||||
max_length=255,
|
max_length=255,
|
||||||
default='All',
|
default='All',
|
||||||
verbose_name=_l("Type of cotisation")
|
verbose_name=_("subscription type")
|
||||||
)
|
)
|
||||||
date_start = models.DateTimeField(
|
date_start = models.DateTimeField(
|
||||||
verbose_name=_l("Starting date")
|
verbose_name=_("start date")
|
||||||
)
|
)
|
||||||
date_end = models.DateTimeField(
|
date_end = models.DateTimeField(
|
||||||
verbose_name=_l("Ending date")
|
verbose_name=_("end date")
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
permissions = (
|
permissions = (
|
||||||
('view_cotisation', _l("Can see a cotisation's details")),
|
('view_cotisation', _("Can view a subscription object")),
|
||||||
('change_all_cotisation', _l("Can edit the previous cotisations")),
|
('change_all_cotisation', _("Can edit the previous subscriptions")),
|
||||||
)
|
)
|
||||||
|
verbose_name = _("subscription")
|
||||||
|
verbose_name_plural = _("subscriptions")
|
||||||
|
|
||||||
def can_edit(self, user_request, *_args, **_kwargs):
|
def can_edit(self, user_request, *_args, **_kwargs):
|
||||||
if not user_request.has_perm('cotisations.change_cotisation'):
|
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') \
|
elif not user_request.has_perm('cotisations.change_all_cotisation') \
|
||||||
and (self.vente.facture.control or
|
and (self.vente.facture.control or
|
||||||
not self.vente.facture.valid):
|
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.")
|
"already controlled or invalidated.")
|
||||||
else:
|
else:
|
||||||
return True, None
|
return True, None
|
||||||
|
@ -808,9 +808,9 @@ class Cotisation(RevMixin, AclMixin, models.Model):
|
||||||
def can_delete(self, user_request, *_args, **_kwargs):
|
def can_delete(self, user_request, *_args, **_kwargs):
|
||||||
if not user_request.has_perm('cotisations.delete_cotisation'):
|
if not user_request.has_perm('cotisations.delete_cotisation'):
|
||||||
return False, _("You don't have the right to delete a "
|
return False, _("You don't have the right to delete a "
|
||||||
"cotisation.")
|
"subscription.")
|
||||||
if self.vente.facture.control or not self.vente.facture.valid:
|
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.")
|
"already controlled or invalidated.")
|
||||||
else:
|
else:
|
||||||
return True, None
|
return True, None
|
||||||
|
@ -818,8 +818,8 @@ class Cotisation(RevMixin, AclMixin, models.Model):
|
||||||
def can_view(self, user_request, *_args, **_kwargs):
|
def can_view(self, user_request, *_args, **_kwargs):
|
||||||
if not user_request.has_perm('cotisations.view_cotisation') and\
|
if not user_request.has_perm('cotisations.view_cotisation') and\
|
||||||
self.vente.facture.user != user_request:
|
self.vente.facture.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 "
|
||||||
"cotisation history.")
|
"subscription history.")
|
||||||
else:
|
else:
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
|
@ -847,3 +847,4 @@ def cotisation_post_delete(**_kwargs):
|
||||||
"""
|
"""
|
||||||
regen('mac_ip_list')
|
regen('mac_ip_list')
|
||||||
regen('mailing')
|
regen('mailing')
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ugettext_lazy as _l
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +35,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _l("User Balance")
|
verbose_name = _("user balance")
|
||||||
|
|
||||||
payment = models.OneToOneField(
|
payment = models.OneToOneField(
|
||||||
Paiement,
|
Paiement,
|
||||||
|
@ -45,8 +44,8 @@ class BalancePayment(PaymentMethodMixin, models.Model):
|
||||||
editable=False
|
editable=False
|
||||||
)
|
)
|
||||||
minimum_balance = models.DecimalField(
|
minimum_balance = models.DecimalField(
|
||||||
verbose_name=_l("Minimum balance"),
|
verbose_name=_("Minimum balance"),
|
||||||
help_text=_l("The minimal amount of money allowed for the balance"
|
help_text=_("The minimal amount of money allowed for the balance"
|
||||||
" at the end of a payment. You can specify negative "
|
" at the end of a payment. You can specify negative "
|
||||||
"amount."
|
"amount."
|
||||||
),
|
),
|
||||||
|
@ -55,8 +54,8 @@ class BalancePayment(PaymentMethodMixin, models.Model):
|
||||||
default=0,
|
default=0,
|
||||||
)
|
)
|
||||||
maximum_balance = models.DecimalField(
|
maximum_balance = models.DecimalField(
|
||||||
verbose_name=_l("Maximum balance"),
|
verbose_name=_("Maximum balance"),
|
||||||
help_text=_l("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,
|
||||||
default=50,
|
default=50,
|
||||||
|
@ -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=_l("Allow user to credit their balance"),
|
verbose_name=_("Allow user to credit their balance"),
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -97,7 +96,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
|
||||||
if len(p) > 0:
|
if len(p) > 0:
|
||||||
form.add_error(
|
form.add_error(
|
||||||
'payment_method',
|
'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):
|
def alter_payment(self, payment):
|
||||||
|
@ -118,3 +117,4 @@ class BalancePayment(PaymentMethodMixin, models.Model):
|
||||||
len(Paiement.find_allowed_payments(user_request)
|
len(Paiement.find_allowed_payments(user_request)
|
||||||
.exclude(is_balance=True)) > 0
|
.exclude(is_balance=True)) > 0
|
||||||
) and self.credit_balance_allowed
|
) and self.credit_balance_allowed
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.urls import reverse
|
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.models import Paiement
|
||||||
from cotisations.payment_methods.mixins import PaymentMethodMixin
|
from cotisations.payment_methods.mixins import PaymentMethodMixin
|
||||||
|
@ -33,7 +33,7 @@ class ChequePayment(PaymentMethodMixin, models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _l("Cheque")
|
verbose_name = _("Cheque")
|
||||||
|
|
||||||
payment = models.OneToOneField(
|
payment = models.OneToOneField(
|
||||||
Paiement,
|
Paiement,
|
||||||
|
@ -52,3 +52,4 @@ class ChequePayment(PaymentMethodMixin, models.Model):
|
||||||
'cotisations:cheque:validate',
|
'cotisations:cheque:validate',
|
||||||
kwargs={'invoice_pk': invoice.pk}
|
kwargs={'invoice_pk': invoice.pk}
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ def cheque(request, invoice_pk):
|
||||||
if invoice.valid or not isinstance(payment_method, ChequePayment):
|
if invoice.valid or not isinstance(payment_method, ChequePayment):
|
||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
_("You cannot pay this invoice with a cheque.")
|
_("You can't pay this invoice with a cheque.")
|
||||||
)
|
)
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
|
@ -67,3 +67,4 @@ def cheque(request, invoice_pk):
|
||||||
'amount': invoice.prix_total()
|
'amount': invoice.prix_total()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ugettext_lazy as _l
|
|
||||||
|
|
||||||
from cotisations.models import Paiement
|
from cotisations.models import Paiement
|
||||||
from cotisations.payment_methods.mixins import PaymentMethodMixin
|
from cotisations.payment_methods.mixins import PaymentMethodMixin
|
||||||
|
@ -37,7 +36,7 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "ComNpay"
|
verbose_name = _("ComNpay")
|
||||||
|
|
||||||
payment = models.OneToOneField(
|
payment = models.OneToOneField(
|
||||||
Paiement,
|
Paiement,
|
||||||
|
@ -49,17 +48,17 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
|
||||||
max_length=255,
|
max_length=255,
|
||||||
default='',
|
default='',
|
||||||
blank=True,
|
blank=True,
|
||||||
verbose_name=_l("ComNpay VAD Number"),
|
verbose_name=_("ComNpay VAT Number"),
|
||||||
)
|
)
|
||||||
payment_pass = AESEncryptedField(
|
payment_pass = AESEncryptedField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
verbose_name=_l("ComNpay Secret Key"),
|
verbose_name=_("ComNpay secret key"),
|
||||||
)
|
)
|
||||||
minimum_payment = models.DecimalField(
|
minimum_payment = models.DecimalField(
|
||||||
verbose_name=_l("Minimum payment"),
|
verbose_name=_("Minimum payment"),
|
||||||
help_text=_l("The minimal amount of money you have to use when paying"
|
help_text=_("The minimal amount of money you have to use when paying"
|
||||||
" with ComNpay"),
|
" with ComNpay"),
|
||||||
max_digits=5,
|
max_digits=5,
|
||||||
decimal_places=2,
|
decimal_places=2,
|
||||||
|
@ -67,7 +66,7 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
|
||||||
)
|
)
|
||||||
production = models.BooleanField(
|
production = models.BooleanField(
|
||||||
default=True,
|
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):
|
def return_url_comnpay(self):
|
||||||
|
@ -102,7 +101,7 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
|
||||||
'action': self.return_url_comnpay(),
|
'action': self.return_url_comnpay(),
|
||||||
'method': 'POST',
|
'method': 'POST',
|
||||||
'content': p.buildSecretHTML(
|
'content': p.buildSecretHTML(
|
||||||
_("Pay invoice no : ")+str(invoice.id),
|
_("Pay invoice number ")+str(invoice.id),
|
||||||
invoice.prix_total(),
|
invoice.prix_total(),
|
||||||
idTransaction=str(invoice.id)
|
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.
|
"""Checks that the price meets the requirement to be paid with ComNpay.
|
||||||
"""
|
"""
|
||||||
return ((price >= self.minimum_payment),
|
return ((price >= self.minimum_payment),
|
||||||
_('In order to pay your invoice with ComNpay'
|
_("In order to pay your invoice with ComNpay, the price must"
|
||||||
', the price must be grater than {} €')
|
" be greater than {} €.").format(self.minimum_payment))
|
||||||
.format(self.minimum_payment))
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ def accept_payment(request, factureid):
|
||||||
if invoice.valid:
|
if invoice.valid:
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The payment of %(amount)s € has been accepted.") % {
|
_("The payment of %(amount)s € was accepted.") % {
|
||||||
'amount': invoice.prix_total()
|
'amount': invoice.prix_total()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -60,8 +60,8 @@ def accept_payment(request, factureid):
|
||||||
for purchase in invoice.vente_set.all()):
|
for purchase in invoice.vente_set.all()):
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The cotisation of %(member_name)s has been \
|
_("The subscription of %(member_name)s was extended to"
|
||||||
extended to %(end_date)s.") % {
|
" %(end_date)s.") % {
|
||||||
'member_name': request.user.pseudo,
|
'member_name': request.user.pseudo,
|
||||||
'end_date': request.user.end_adhesion()
|
'end_date': request.user.end_adhesion()
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ def refuse_payment(request):
|
||||||
"""
|
"""
|
||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
_("The payment has been refused.")
|
_("The payment was refused.")
|
||||||
)
|
)
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
|
@ -136,3 +136,4 @@ def ipn(request):
|
||||||
# Everything worked we send a reponse to Comnpay indicating that
|
# Everything worked we send a reponse to Comnpay indicating that
|
||||||
# it's ok for them to proceed
|
# it's ok for them to proceed
|
||||||
return HttpResponse("HTTP/1.0 200 OK")
|
return HttpResponse("HTTP/1.0 200 OK")
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.translation import ugettext_lazy as _l
|
|
||||||
|
|
||||||
from . import PAYMENT_METHODS
|
from . import PAYMENT_METHODS
|
||||||
from cotisations.utils import find_payment_method
|
from cotisations.utils import find_payment_method
|
||||||
|
@ -58,8 +57,8 @@ class PaymentMethodForm(forms.Form):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
payment_method = forms.ChoiceField(
|
payment_method = forms.ChoiceField(
|
||||||
label=_l("Special payment method"),
|
label=_("Special payment method"),
|
||||||
help_text=_l("Warning : You will not be able to change the payment "
|
help_text=_("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."
|
||||||
),
|
),
|
||||||
|
@ -70,7 +69,7 @@ class PaymentMethodForm(forms.Form):
|
||||||
super(PaymentMethodForm, self).__init__(*args, **kwargs)
|
super(PaymentMethodForm, self).__init__(*args, **kwargs)
|
||||||
prefix = kwargs.get('prefix', None)
|
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 = [(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 = {
|
self.fields['payment_method'].widget.attrs = {
|
||||||
'id': 'paymentMethodSelect'
|
'id': 'paymentMethodSelect'
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Article" %}</th>
|
<th>{% trans "Article" %}</th>
|
||||||
<th>{% trans "Price" %}</th>
|
<th>{% trans "Price" %}</th>
|
||||||
<th>{% trans "Cotisation type" %}</th>
|
<th>{% trans "Subscription type" %}</th>
|
||||||
<th>{% trans "Duration (month)" %}</th>
|
<th>{% trans "Duration (in months)" %}</th>
|
||||||
<th>{% trans "Concerned users" %}</th>
|
<th>{% trans "Concerned users" %}</th>
|
||||||
<th>{% trans "Available for everyone" %}</th>
|
<th>{% trans "Available for everyone" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
|
|
@ -38,9 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ banque.name }}</td>
|
<td>{{ banque.name }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit banque %}
|
{% can_edit banque %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" title="{% trans "Edit" %}" href="{% url 'cotisations:edit-banque' banque.id %}">
|
{% include 'buttons/edit.html' with href='cotisations:edit-banque' id=banque.id %}
|
||||||
<i class="fa fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button banque %}
|
{% history_button banque %}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -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 %}
|
{% include 'buttons/sort.html' with prefix='cotis' col='date' text=tr_date %}
|
||||||
</th>
|
</th>
|
||||||
<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 %}
|
{% include 'buttons/sort.html' with prefix='cotis' col='id' text=tr_invoice_id %}
|
||||||
</th>
|
</th>
|
||||||
<th></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.date }}</td>
|
||||||
<td>{{ facture.id }}</td>
|
<td>{{ facture.id }}</td>
|
||||||
<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 %}
|
{% can_edit facture %}
|
||||||
<li>
|
{% include 'buttons/edit.html' with href='cotisations:edit-facture' id=facture.id %}
|
||||||
<a href="{% url 'cotisations:edit-facture' facture.id %}">
|
|
||||||
<i class="fa fa-dollar-sign"></i> {% trans "Edit" %}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% acl_else %}
|
{% acl_else %}
|
||||||
<li>{% trans "Controlled invoice" %}</li>
|
{% trans "Controlled invoice" %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_delete facture %}
|
{% can_delete facture %}
|
||||||
<li>
|
{% include 'buttons/suppr.html' with href='cotisations:del-facture' id=facture.id %}
|
||||||
<a href="{% url 'cotisations:del-facture' facture.id %}">
|
|
||||||
<i class="fa fa-trash"></i> {% trans "Delete" %}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
<li>
|
|
||||||
{% history_button facture text=True html_class=False %}
|
{% history_button facture text=True html_class=False %}
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if facture.valid %}
|
{% 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 %}
|
{% include 'pagination.html' with list=facture_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -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 %}
|
{% include 'buttons/sort.html' with prefix='invoice' col='date' text=tr_date %}
|
||||||
</th>
|
</th>
|
||||||
<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 %}
|
{% include 'buttons/sort.html' with prefix='invoice' col='id' text=tr_invoice_id %}
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
|
|
|
@ -30,17 +30,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% block title %}{% trans "Invoice control" %}{% endblock %}
|
{% block title %}{% trans "Invoice control" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h2>{% trans "Invoice control and validation" %}</h2>
|
<h2>{% trans "Invoice control and validation" %}</h2>
|
||||||
|
|
||||||
{% if facture_list.paginator %}
|
{% if facture_list.paginator %}
|
||||||
{% include 'pagination.html' with list=facture_list %}
|
{% include 'pagination.html' with list=facture_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ controlform.management_form }}
|
{{ controlform.management_form }}
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Profil" %}</th>
|
<th>{% trans "Profile" %}</th>
|
||||||
<th>
|
<th>
|
||||||
{% trans "Last name" as tr_last_name %}
|
{% trans "Last name" as tr_last_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_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 %}
|
{% include 'buttons/sort.html' with prefix='control' col='surname' text=tr_first_name %}
|
||||||
</th>
|
</th>
|
||||||
<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 %}
|
{% include 'buttons/sort.html' with prefix='control' col='id' text=tr_invoice_id %}
|
||||||
</th>
|
</th>
|
||||||
<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 %}
|
{% include 'buttons/sort.html' with prefix='control' col='user-id' text=tr_user_id %}
|
||||||
</th>
|
</th>
|
||||||
<th>{% trans "Designation" %}</th>
|
<th>{% trans "Designation" %}</th>
|
||||||
|
@ -65,7 +68,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
{% trans "Date" as tr_date %}
|
{% 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>
|
||||||
<th>
|
<th>
|
||||||
{% trans "Validated" as tr_validated %}
|
{% 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 %}
|
{% if facture_list.paginator %}
|
||||||
{% include 'pagination.html' with list=facture_list %}
|
{% include 'pagination.html' with list=facture_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -26,18 +26,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{% trans "Deletion of cotisations" %}{% endblock %}
|
{% block title %}{% trans "Deletion of subscriptions" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<h4>
|
<h4>
|
||||||
{% blocktrans %}
|
{% blocktrans %}Warning: are you sure you really want to delete this {{ object_name }} object ( {{ objet }} )?{% endblocktrans %}
|
||||||
Warning. Are you sure you really want te delete this {{ object_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' %}
|
{% bootstrap_button tr_confirm button_type='submit' icon='trash' %}
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% load massive_bootstrap_form %}
|
{% load massive_bootstrap_form %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{% trans "Invoices creation and edition" %}{% endblock %}
|
{% block title %}{% trans "Creation and editing of invoices" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% bootstrap_form_errors factureform %}
|
{% bootstrap_form_errors factureform %}
|
||||||
|
@ -62,3 +62,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -27,20 +27,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% load staticfiles%}
|
{% load staticfiles%}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{% trans "Invoices creation and edition" %}{% endblock %}
|
{% block title %}{% trans "Creation and editing of invoices" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% if title %}
|
{% if title %}
|
||||||
<h3>{{ title }}</h3>
|
<h3>{{ title }}</h3>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h3>{% trans "New invoice" %}</h3>
|
<h3>{% trans "New invoice" %}</h3>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if max_balance %}
|
{% if max_balance %}
|
||||||
<h4>{% trans "Maximum allowed balance : "%}{{max_balance}} €</h4>
|
<h4>{% blocktrans %}Maximum allowed balance: {{ max_balance }} €{% endblocktrans %}</h4>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if balance is not None %}
|
{% if balance is not None %}
|
||||||
<p>
|
<p>
|
||||||
{% trans "Current balance :" %} {{ balance }} €
|
{% blocktrans %}Current balance: {{ balance }} €{% endblocktrans %}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -68,9 +69,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</div>
|
</div>
|
||||||
<input class="btn btn-primary btn-sm" role="button" value="{% trans "Add an article"%}" id="add_one">
|
<input class="btn btn-primary btn-sm" role="button" value="{% trans "Add an article"%}" id="add_one">
|
||||||
<p>
|
<p>
|
||||||
{% blocktrans %}
|
{% blocktrans %}Total price: <span id="total_price">0,00</span> €{% endblocktrans %}
|
||||||
Total price : <span id="total_price">0,00</span> €
|
|
||||||
{% endblocktrans %}
|
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% bootstrap_button action_name button_type='submit' icon='star' %}
|
{% 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 %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% block title %}{% trans "Invoices" %}{% endblock %}
|
{% block title %}{% trans "Invoices" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "Cotisations" %}</h2>
|
<h2>{% trans "Subscriptions" %}</h2>
|
||||||
{% include 'cotisations/aff_cotisations.html' with facture_list=facture_list %}
|
{% include 'cotisations/aff_cotisations.html' with facture_list=facture_list %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</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 article types" %}
|
<i class="fa fa-trash"></i> {% trans "Delete one or several article types" %}
|
||||||
</a>
|
</a>
|
||||||
{% include 'cotisations/aff_article.html' with article_list=article_list %}
|
{% include 'cotisations/aff_article.html' with article_list=article_list %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</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' %}">
|
||||||
<i class="fa fa-trash"></i> {% trans "Delete banks" %}
|
<i class="fa fa-trash"></i> {% trans "Delete one or several banks" %}
|
||||||
</a>
|
</a>
|
||||||
{% include 'cotisations/aff_banque.html' with banque_list=banque_list %}
|
{% include 'cotisations/aff_banque.html' with banque_list=banque_list %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -27,17 +27,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{% trans "Payments" %}{% endblock %}
|
{% block title %}{% trans "Payment methods" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "Payment types list" %}</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 type" %}
|
<i class="fa fa-cart-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' %}">
|
||||||
<i class="fa fa-trash"></i> {% trans "Delete payment types" %}
|
<i class="fa fa-trash"></i> {% trans "Delete one or several payment methods" %}
|
||||||
</a>
|
</a>
|
||||||
{% include 'cotisations/aff_paiement.html' with paiement_list=paiement_list %}
|
{% include 'cotisations/aff_paiement.html' with paiement_list=paiement_list %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -31,9 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>
|
<h3>
|
||||||
{% blocktrans %}
|
{% blocktrans %}Pay {{ amount }} €{% endblocktrans %}
|
||||||
Pay {{ amount }} €
|
|
||||||
{% endblocktrans %}
|
|
||||||
</h3>
|
</h3>
|
||||||
<form class="form" method="{{ method|default:"post" }}" action="{{ action }}">
|
<form class="form" method="{{ method|default:"post" }}" action="{{ action }}">
|
||||||
{{ content | safe }}
|
{{ content | safe }}
|
||||||
|
@ -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' %}
|
{% bootstrap_button tr_pay button_type='submit' icon='piggy-bank' %}
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -61,3 +61,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -17,5 +17,6 @@ def check_no_balance(is_balance):
|
||||||
p = Paiement.objects.filter(is_balance=True)
|
p = Paiement.objects.filter(is_balance=True)
|
||||||
if len(p) > 0:
|
if len(p) > 0:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_("There are already payment method(s) for user balance")
|
_("There is already a payment method for user balance.")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ def new_custom_invoice(request):
|
||||||
)
|
)
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_('The custom invoice was successfully created.')
|
_("The custom invoice was created.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index-custom-invoice'))
|
return redirect(reverse('cotisations:index-custom-invoice'))
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ def edit_facture(request, facture, **_kwargs):
|
||||||
purchase_form.save()
|
purchase_form.save()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The invoice has been successfully edited.")
|
_("The invoice was edited.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index'))
|
return redirect(reverse('cotisations:index'))
|
||||||
return form({
|
return form({
|
||||||
|
@ -333,7 +333,7 @@ def del_facture(request, facture, **_kwargs):
|
||||||
facture.delete()
|
facture.delete()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The invoice has been successfully deleted.")
|
_("The invoice was deleted.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index'))
|
return redirect(reverse('cotisations:index'))
|
||||||
return form({
|
return form({
|
||||||
|
@ -367,7 +367,7 @@ def edit_custom_invoice(request, invoice, **kwargs):
|
||||||
purchase_form.save()
|
purchase_form.save()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The invoice has been successfully edited.")
|
_("The invoice was edited.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index-custom-invoice'))
|
return redirect(reverse('cotisations:index-custom-invoice'))
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ def del_custom_invoice(request, invoice, **_kwargs):
|
||||||
invoice.delete()
|
invoice.delete()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The invoice has been successfully deleted.")
|
_("The invoice was deleted.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index-custom-invoice'))
|
return redirect(reverse('cotisations:index-custom-invoice'))
|
||||||
return form({
|
return form({
|
||||||
|
@ -453,7 +453,7 @@ def add_article(request):
|
||||||
article.save()
|
article.save()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The article has been successfully created.")
|
_("The article was created.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index-article'))
|
return redirect(reverse('cotisations:index-article'))
|
||||||
return form({
|
return form({
|
||||||
|
@ -475,7 +475,7 @@ def edit_article(request, article_instance, **_kwargs):
|
||||||
article.save()
|
article.save()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The article has been successfully edited.")
|
_("The article was edited.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index-article'))
|
return redirect(reverse('cotisations:index-article'))
|
||||||
return form({
|
return form({
|
||||||
|
@ -497,7 +497,7 @@ def del_article(request, instances):
|
||||||
article_del.delete()
|
article_del.delete()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The article(s) have been successfully deleted.")
|
_("The articles were deleted.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index-article'))
|
return redirect(reverse('cotisations:index-article'))
|
||||||
return form({
|
return form({
|
||||||
|
@ -525,7 +525,7 @@ def add_paiement(request):
|
||||||
payment_method.save(payment)
|
payment_method.save(payment)
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The payment method has been successfully created.")
|
_("The payment method was created.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index-paiement'))
|
return redirect(reverse('cotisations:index-paiement'))
|
||||||
return form({
|
return form({
|
||||||
|
@ -561,8 +561,7 @@ def edit_paiement(request, paiement_instance, **_kwargs):
|
||||||
if payment_method is not None:
|
if payment_method is not None:
|
||||||
payment_method.save()
|
payment_method.save()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,_("The payment method was edited.")
|
||||||
_("The payement method has been successfully edited.")
|
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index-paiement'))
|
return redirect(reverse('cotisations:index-paiement'))
|
||||||
return form({
|
return form({
|
||||||
|
@ -588,8 +587,7 @@ def del_paiement(request, instances):
|
||||||
payment_del.delete()
|
payment_del.delete()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The payment method %(method_name)s has been \
|
_("The payment method %(method_name)s was deleted.") % {
|
||||||
successfully deleted.") % {
|
|
||||||
'method_name': payment_del
|
'method_name': payment_del
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -621,7 +619,7 @@ def add_banque(request):
|
||||||
bank.save()
|
bank.save()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The bank has been successfully created.")
|
_("The bank was created.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index-banque'))
|
return redirect(reverse('cotisations:index-banque'))
|
||||||
return form({
|
return form({
|
||||||
|
@ -644,7 +642,7 @@ def edit_banque(request, banque_instance, **_kwargs):
|
||||||
bank.save()
|
bank.save()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The bank has been successfully edited")
|
_("The bank was edited.")
|
||||||
)
|
)
|
||||||
return redirect(reverse('cotisations:index-banque'))
|
return redirect(reverse('cotisations:index-banque'))
|
||||||
return form({
|
return form({
|
||||||
|
@ -669,8 +667,7 @@ def del_banque(request, instances):
|
||||||
bank_del.delete()
|
bank_del.delete()
|
||||||
messages.success(
|
messages.success(
|
||||||
request,
|
request,
|
||||||
_("The bank %(bank_name)s has been successfully \
|
_("The bank %(bank_name)s was deleted.") % {
|
||||||
deleted.") % {
|
|
||||||
'bank_name': bank_del
|
'bank_name': bank_del
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -873,3 +870,4 @@ def credit_solde(request, user, **_kwargs):
|
||||||
'action_name': _("Pay"),
|
'action_name': _("Pay"),
|
||||||
'max_balance': p.payment_method.maximum_balance,
|
'max_balance': p.payment_method.maximum_balance,
|
||||||
}, 'cotisations/facture.html', request)
|
}, 'cotisations/facture.html', request)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue