133 lines
3.0 KiB
Markdown
133 lines
3.0 KiB
Markdown
# Facturation Association
|
|
|
|
Application de facturation légale française pour associations (loi 1901),
|
|
non assujetties à la TVA (art. 293B du CGI).
|
|
|
|
## Fonctionnalités
|
|
|
|
- Gestion des clients
|
|
- Devis avec numérotation automatique (DEV-AAAA-XXXX)
|
|
- Factures avec numérotation chronologique (AAAA-XXXX)
|
|
- Conversion devis → facture
|
|
- Génération PDF avec toutes les mentions légales françaises
|
|
- Suivi des statuts (émise / payée / annulée)
|
|
|
|
## Stack
|
|
|
|
- **FastAPI** + Jinja2 (interface web)
|
|
- **SQLite** + SQLAlchemy (stockage)
|
|
- **WeasyPrint** (génération PDF)
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
# Cloner / copier le projet
|
|
cd factures/
|
|
|
|
# Créer un environnement virtuel
|
|
python3 -m venv venv
|
|
source venv/bin/activate
|
|
|
|
# Installer les dépendances
|
|
pip install -r requirements.txt
|
|
|
|
# Configurer l'association
|
|
cp .env.example .env
|
|
nano .env # remplir les informations de l'association
|
|
|
|
# Lancer en développement
|
|
uvicorn main:app --reload --host 0.0.0.0 --port 8000
|
|
```
|
|
|
|
## Déploiement VPS (production)
|
|
|
|
### Avec systemd
|
|
|
|
Créer `/etc/systemd/system/facturation.service` :
|
|
|
|
```ini
|
|
[Unit]
|
|
Description=Facturation Association
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=www-data
|
|
WorkingDirectory=/opt/facturation
|
|
Environment="PATH=/opt/facturation/venv/bin"
|
|
ExecStart=/opt/facturation/venv/bin/uvicorn main:app --host 127.0.0.1 --port 8000
|
|
Restart=always
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
```bash
|
|
sudo systemctl enable facturation
|
|
sudo systemctl start facturation
|
|
```
|
|
|
|
### Reverse proxy nginx
|
|
|
|
```nginx
|
|
server {
|
|
listen 80;
|
|
server_name factures.monasso.fr;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8000;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
}
|
|
}
|
|
```
|
|
|
|
### HTTPS avec Certbot
|
|
|
|
```bash
|
|
sudo certbot --nginx -d factures.monasso.fr
|
|
```
|
|
|
|
### Dépendances système pour WeasyPrint (Debian/Ubuntu)
|
|
|
|
```bash
|
|
sudo apt install python3-dev python3-pip libpango-1.0-0 libpangoft2-1.0-0 \
|
|
libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
|
|
```
|
|
|
|
## Configuration (.env)
|
|
|
|
| Variable | Description |
|
|
|---|---|
|
|
| `ASSO_NOM` | Nom de l'association |
|
|
| `ASSO_ADRESSE` | Adresse |
|
|
| `ASSO_CODE_POSTAL` | Code postal |
|
|
| `ASSO_VILLE` | Ville |
|
|
| `ASSO_EMAIL` | Email de contact |
|
|
| `ASSO_RNA` | Numéro RNA (W...) |
|
|
| `ASSO_SIRET` | SIRET si disponible |
|
|
| `ASSO_IBAN` | IBAN pour le pied de page PDF |
|
|
| `ASSO_BIC` | BIC |
|
|
| `DEVIS_PREFIX` | Préfixe devis (défaut: DEV) |
|
|
|
|
## Mentions légales incluses dans les PDF
|
|
|
|
- Numéro de facture chronologique unique
|
|
- Date d'émission et d'échéance
|
|
- Identification complète émetteur et destinataire
|
|
- Détail des lignes HT
|
|
- Mention TVA non applicable art. 293B CGI
|
|
- Conditions de règlement
|
|
- Pénalités de retard légales (art. L.441-10 C. com.)
|
|
- Indemnité forfaitaire recouvrement 40€
|
|
- Coordonnées bancaires
|
|
|
|
## Sauvegarde
|
|
|
|
La base de données est le fichier `factures.db`. Il suffit de le copier régulièrement.
|
|
|
|
```bash
|
|
# Exemple cron quotidien
|
|
0 2 * * * cp /opt/facturation/factures.db /backup/factures-$(date +\%Y\%m\%d).db
|
|
```
|