1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-02-24 09:01:18 +00:00

Compare commits

...

14 Commits

Author SHA1 Message Date
aeltheos
7a1e9743e3 Merge branch 'nix-shell' into 'main'
Nix shell

See merge request bde/nk20!201
2024-03-27 20:57:40 +01:00
quark
7afd15b1cc Merge branch 'invoice_modification' into 'main'
changement template facture

Closes #128

See merge request bde/nk20!243
2024-03-27 19:10:40 +01:00
korenstin
258361f116 Update forms.py 2024-03-27 10:25:38 +01:00
korenstin
a307530579 Merge branch 'change_date' into 'main'
change date

See merge request bde/nk20!245
2024-03-27 10:19:37 +01:00
quark
5de930bf40 Update forms.py 2024-03-27 10:04:14 +01:00
quark
f7ebe0e99b Update forms.py 2024-03-27 09:43:49 +01:00
quark
73de6e2176 Update forms.py 2024-03-27 09:20:32 +01:00
test
201611b105 change date 2024-03-26 08:33:34 +01:00
quark
40c239e9da Update models.py 2024-03-24 16:41:18 +01:00
quark
2aaab2b454 Update test_treasury.py 2024-03-24 15:55:46 +01:00
quark
fc088dec86 Update test_treasury.py 2024-03-24 15:20:46 +01:00
quark
ffac940511 changement template facture 2024-03-22 18:22:08 +01:00
Yoann Beaugnon
dde1baa25c typo 2022-08-21 19:50:53 +02:00
Yoann Beaugnon
7a7ee47e0b Add two shell.nix to enable easier development on nixos. 2022-08-21 19:46:11 +02:00
12 changed files with 894 additions and 740 deletions

1
.gitignore vendored
View File

@ -48,7 +48,6 @@ backups/
env/ env/
venv/ venv/
db.sqlite3 db.sqlite3
shell.nix
# ansibles customs host # ansibles customs host
ansible/host_vars/*.yaml ansible/host_vars/*.yaml

View File

@ -17,4 +17,24 @@ SPDX-License-Identifier: GPL-3.0-or-later
</form> </form>
</div> </div>
</div> </div>
<script>
var date_end = document.getElementById("id_date_end");
var date_start = document.getElementById("id_date_start");
function update_date_end (){
if(date_end.value=="" || date_end.value<date_start.value){
date_end.value = date_start.value;
};
};
function update_date_start (){
if(date_start.value=="" || date_end.value<date_start.value){
date_start.value = date_end.value;
};
};
date_start.addEventListener('focusout', update_date_end);
date_end.addEventListener('focusout', update_date_start);
</script>
{% endblock %} {% endblock %}

View File

@ -5,7 +5,7 @@ from django import forms
from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from member.models import Club # from member.models import Club
from note.models import NoteSpecial, Alias from note.models import NoteSpecial, Alias
from note_kfet.inputs import AmountInput from note_kfet.inputs import AmountInput
@ -117,10 +117,10 @@ class ValidationForm(forms.Form):
) )
# If the bda exists # If the bda exists
if Club.objects.filter(name__iexact="bda").exists(): # if Club.objects.filter(name__iexact="bda").exists():
# The user can join the bda club at the inscription # The user can join the bda club at the inscription
join_bda = forms.BooleanField( # join_bda = forms.BooleanField(
label=_("Join BDA Club"), # label=_("Join BDA Club"),
required=False, # required=False,
initial=True, # initial=True,
) # )

View File

@ -0,0 +1,23 @@
# Generated by Django 2.2.28 on 2024-03-21 23:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('treasury', '0007_auto_20240311_1549'),
]
operations = [
migrations.AddField(
model_name='invoice',
name='payment_date',
field=models.CharField(default='', max_length=255, verbose_name='Payment date'),
),
migrations.AddField(
model_name='invoice',
name='quotation',
field=models.BooleanField(default=False, verbose_name='Quotation'),
),
]

View File

@ -41,6 +41,10 @@ class Invoice(models.Model):
), ),
verbose_name=_("BDE"), verbose_name=_("BDE"),
) )
quotation = models.BooleanField(
default=False,
verbose_name=_("Quotation"),
)
object = models.CharField( object = models.CharField(
max_length=255, max_length=255,
@ -65,6 +69,12 @@ class Invoice(models.Model):
verbose_name=_("Date"), verbose_name=_("Date"),
) )
payment_date = models.CharField(
default="",
max_length=255,
verbose_name=_("Payment date"),
)
acquitted = models.BooleanField( acquitted = models.BooleanField(
verbose_name=_("Acquitted"), verbose_name=_("Acquitted"),
default=False, default=False,

View File

@ -76,8 +76,11 @@
\def\FactureNum {{"{"}}{{ obj.id }}} % Numéro de facture \def\FactureNum {{"{"}}{{ obj.id }}} % Numéro de facture
\def\FactureAcquittee {% if obj.acquitted %} {oui} {% else %} {non} {% endif %} % Facture acquittée : oui/non \def\FactureAcquittee {% if obj.acquitted %} {oui} {% else %} {non} {% endif %} % Facture acquittée : oui/non
\def\Devis {% if obj.quotation %} {oui} {% else %} {non} {% endif %}
% Devis : oui/non
\def\FactureLieu {{"{"}}{{ obj.place|escape_tex }}} % Lieu de l'édition de la facture \def\FactureLieu {{"{"}}{{ obj.place|escape_tex }}} % Lieu de l'édition de la facture
\def\FactureDate {{"{"}}{{ obj.date }}} % Date de l'édition de la facture \def\FactureDate {{"{"}}{{ obj.date }}} % Date de l'édition de la facture
\def\FacturePaymentDate {{"{"}}{{ obj.payment_date|escape_tex }}} % Date de paiement de la facture
\def\FactureObjet {{"{"}}{{ obj.object|escape_tex }} } % Objet du document \def\FactureObjet {{"{"}}{{ obj.object|escape_tex }} } % Objet du document
% Description de la facture % Description de la facture
\def\FactureDescr {{"{"}}{{ obj.description|escape_tex }}} \def\FactureDescr {{"{"}}{{ obj.description|escape_tex }}}
@ -118,10 +121,12 @@
% Nom et adresse de la société % Nom et adresse de la société
\MonNom \\ \MonNom \\
\MonAdresseRue \\ \MonAdresseRue \\
\MonAdresseVille \MonAdresseVille \\
\ifthenelse{\equal{\Devis}{oui}}{
Devis n°\FactureNum
}{
Facture n°\FactureNum Facture n°\FactureNum
}
{\addtolength{\leftskip}{10.5cm} %in ERT {\addtolength{\leftskip}{10.5cm} %in ERT
\ClientNom \\ \ClientNom \\
@ -139,6 +144,7 @@ Facture n°\FactureNum
\textnormal{\FactureDescr} \textnormal{\FactureDescr}
~\\ ~\\
\begin{center} \begin{center}
@ -154,6 +160,11 @@ Facture n°\FactureNum
\ifthenelse{\equal{\FactureAcquittee}{oui}}{ \ifthenelse{\equal{\FactureAcquittee}{oui}}{
Facture acquittée. Facture acquittée.
}{ }{
Echéance de paiement : \FacturePaymentDate
Conditions d'escompte : Aucune
Taux de pénalité en cas de non paiement ou retard de paiement : 0 \%
À régler par chèque ou par virement bancaire : À régler par chèque ou par virement bancaire :
@ -176,5 +187,6 @@ Facture n°\FactureNum
TVA non applicable, article 293 B du CGI. TVA non applicable, article 293 B du CGI.
\end{center} \end{center}
\end{document} \end{document}
{% endlanguage %} {% endlanguage %}

View File

@ -69,9 +69,11 @@ class TestInvoices(TestCase):
response = self.client.post(reverse("treasury:invoice_create"), data={ response = self.client.post(reverse("treasury:invoice_create"), data={
"id": 42, "id": 42,
"object": "Same object", "object": "Same object",
"quotation": True,
"description": "Longer description", "description": "Longer description",
"name": "Me and others", "name": "Me and others",
"address": "Alwways earth", "address": "Alwways earth",
"payment_date": "Maybe someday...",
"acquitted": True, "acquitted": True,
"products-0-designation": "Designation", "products-0-designation": "Designation",
"products-0-quantity": 1, "products-0-quantity": 1,
@ -97,8 +99,10 @@ class TestInvoices(TestCase):
"object": "Same object", "object": "Same object",
"description": "Longer description", "description": "Longer description",
"name": "Me and others", "name": "Me and others",
"quotation": False,
"address": "Always earth", "address": "Always earth",
"acquitted": True, "acquitted": True,
"payment_date": "Never",
"locked": True, "locked": True,
"products-0-designation": "Designation", "products-0-designation": "Designation",
"products-0-quantity": 1, "products-0-quantity": 1,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

34
shell-static.nix Executable file
View File

@ -0,0 +1,34 @@
# This is a workaround meant for use with the nix package manager. If you don't know what it is or don't use it, please ignore this file.
#
# The nk20 javascript static location are hardcoded for imperative system.
# This make ./manage.py collectstatic hard to use with nixos.
#
# A workaround is to enter a FHSUserEnv with the static placed under /share/javascript/<static>.
# This emulate a debian like system and enable collecting static normally with ./manage.py collectstatics.
# The regular shell.nix should be enough for other configurations.
#
# Warning, you are still supposed to use pip package with a venv !
{ pkgs ? import <nixpkgs> {} }:
(pkgs.buildFHSUserEnv {
name = "pipzone";
targetPkgs = pkgs: (with pkgs;
let
fhs-static = stdenv.mkDerivation {
name = "fhs-static";
buildCommand = ''
mkdir -p $out/share/javascript/bootstrap4
mkdir -p $out/share/javascript/jquery
ln -s ${python39Packages.xstatic-bootstrap}/lib/python3.9/site-packages/xstatic/pkg/bootstrap/data/* $out/share/javascript/bootstrap4
ln -s ${python39Packages.xstatic-jquery}/lib/python3.9/site-packages/xstatic/pkg/jquery/data/* $out/share/javascript/jquery
'';
};
in [
fhs-static
python39
gettext
python39Packages.pip
python39Packages.virtualenv
python39Packages.setuptools
]);
runScript = "bash";
}).env

23
shell.nix Executable file
View File

@ -0,0 +1,23 @@
# This is meant for use with the nix package manager. If you don't know what it is or don't use it, please ignore this file.
#
# This shell.nix contains all dependencies require to create a venv and pip install -r requirements.txt.
#
# Please check shell-static.nix for running ./manage.py collectstatics.
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = with pkgs; [
python39
python39Packages.pip
python39Packages.setuptools
gettext
];
shellHook = ''
# Tells pip to put packages into $PIP_PREFIX instead of the usual locations.
# See https://pip.pypa.io/en/stable/user_guide/#environment-variables.
export PIP_PREFIX=$(pwd)/_build/pip_packages
export PYTHONPATH="$PIP_PREFIX/${pkgs.python39.sitePackages}:$PYTHONPATH"
export PATH="$PIP_PREFIX/bin:$PATH"
unset SOURCE_DATE_EPOCH
'';
}