diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..2b3db51 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,16 @@ +name: Deploy via Portainer + +on: + push: + branches: [main] + workflow_dispatch: + +jobs: + deploy: + runs-on: self-hosted + steps: + - name: Trigger Portainer stack redeploy + run: | + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST "${{ secrets.PORTAINER_WEBHOOK }}") + echo "HTTP: $HTTP_CODE" + [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "204" ] || exit 1 diff --git a/compta/templates/compta/base.html b/compta/templates/compta/base.html index 66e1552..ad784be 100644 --- a/compta/templates/compta/base.html +++ b/compta/templates/compta/base.html @@ -5,83 +5,146 @@ JB Compta — {% block titre %}Tableau de bord{% endblock %} +{% block extrastyle %}{% endblock %} - -{% if not entreprise %} -

Aucune entreprise

-

Crée une entreprise dans l'administration, - ou saisis une opération.

-{% else %} - - -

{{ entreprise.nom }}

-
{{ entreprise.get_activite_display }} (principale) · - {% if entreprise.franchise_tva %}Franchise de TVA{% else %}Assujetti TVA{% endif %} - {% if entreprise.versement_liberatoire %}· Versement libératoire{% endif %} - · Exercice {{ annee }}
- -
- - - {% block extrafilters %}{% endblock %} -
- - {% block content %}{% endblock %} -{% endif %} - +
+ +
+
+
+ + JB Compta +
+ {% block topbar %} + {% if entreprise %} +

{{ entreprise.nom }}

+
{{ entreprise.get_activite_display }} (principale) · + {% if entreprise.franchise_tva %}Franchise de TVA{% else %}Assujetti TVA{% endif %} + {% if entreprise.versement_liberatoire %}· Versement libératoire{% endif %} + · Exercice {{ annee }}
+
+ + + {% block extrafilters %}{% endblock %} +
+ {% else %} +

Aucune entreprise

+

Crée une entreprise dans l'administration, + ou saisis une opération.

+ {% endif %} + {% endblock %} + {% block content %}{% endblock %} +
+
{% block scripts %}{% endblock %} diff --git a/compta/templates/compta/gestion.html b/compta/templates/compta/gestion.html index 61f836a..96b754e 100644 --- a/compta/templates/compta/gestion.html +++ b/compta/templates/compta/gestion.html @@ -1,84 +1,47 @@ -{% load l10n %} - - - - -JB Compta — Entrées / sorties +{% extends "compta/base.html" %} +{% load l10n %} +{% block titre %}Entrées / sorties{% endblock %} + +{% block extrastyle %} - - - -{% if not entreprise %} -

Aucune entreprise

-

Crée une entreprise dans l'administration.

-{% else %} - +{% endblock %} +{% block topbar %}

Entrées / sorties

-
{{ entreprise.nom }} — vue unifiée de toutes les opérations importées
+
{{ entreprise.nom }} — vue unifiée de toutes les opérations (recettes, dépenses, mouvements)
{% for m in messages %}
{{ m }}
{% endfor %} @@ -90,7 +53,10 @@
- + - - Réinitialiser + + Réinitialiser
+{% endblock %} +{% block content %} +{% if entreprise %} {% if rows %} - +
+
+ - + {% for r in rows %} + - - - + +
DateTypeLibelléCatégorieMontantTVAMontantTVA
{{ r.date|date:"d/m/Y" }} {{ r.type_label }} {{ r.libelle }} {{ r.categorie }}{% if r.neutre %}neutre{% endif %}{{ r.montant|floatformat:2|unlocalize }} €{% if r.tva %}{{ r.tva|floatformat:2|unlocalize }}{% else %}—{% endif %} + {{ r.montant|floatformat:2|unlocalize }} €{% if r.tva %}{{ r.tva|floatformat:2|unlocalize }}{% else %}—{% endif %}
+ + +
+ {% csrf_token %} + + + + 0 sélectionnée(s) + + +
{% else %}
Aucune opération ne correspond à ces filtres.
{% endif %} @@ -234,10 +218,10 @@
Le montant est géré par les lignes de facture — modifiez-le dans l'admin.
- +
- +
@@ -251,9 +235,12 @@ +{{ cats_json|json_script:"cats-data" }} +{% endblock %} +{% block scripts %} - - +{% endblock %} diff --git a/compta/templates/compta/import_csv.html b/compta/templates/compta/import_csv.html index 1ca5e80..139bcb7 100644 --- a/compta/templates/compta/import_csv.html +++ b/compta/templates/compta/import_csv.html @@ -1,49 +1,38 @@ -{% load l10n %} - - - - -JB Compta — Import +{% extends "compta/base.html" %} +{% load l10n %} +{% block titre %}Importer{% endblock %} + +{% block extrastyle %} - - -

Importer un relevé

-
← Tableau de bord · Saisie manuelle
+{% endblock %} +{% block topbar %} +

Importer un relevé

+
Synchronisation Indy, CSV, ou capture d'écran (OCR) — avec aperçu éditable et anti-doublon.
+{% endblock %} + +{% block content %} +
{% if erreurs %}{% for e in erreurs %}
{{ e }}
{% endfor %}{% endif %} {% if resultat %} -
Import terminé : +
Import terminé : {% for k, v in resultat.items %}{{ v }} {{ k }}{% if not forloop.last %} · {% endif %}{% endfor %}. - Voir dépenses · factures.
+ Voir Entrées / sorties.
{% endif %} {% if ocr_debug %} @@ -60,7 +49,7 @@ {% csrf_token %}

① Synchroniser depuis Indy (recommandé)

Récupère tes transactions directement depuis l'API Indy. Anti-doublon automatique. - · 📌 Installer le favori « Indy → CSV » (le plus simple, depuis ton navigateur)
+ · Installer le favori « Indy → CSV » (le plus simple, depuis ton navigateur)
@@ -74,7 +63,7 @@
- +
@@ -98,10 +87,10 @@
- +
- +
{% endif %} @@ -111,6 +100,7 @@ {% csrf_token %}

Aperçu éditable — {{ lignes|length }} ligne(s){% if source == 'indy' %} (Indy){% elif source == 'ocr' %} (OCR){% endif %}

+
@@ -138,27 +128,30 @@ {% endfor %}
DateLibelléCatégorieRégime TVATaux %Montant €Type
+
- +
{% endif %} +
+{% endblock %} - - - + } + }); + +{% endblock %} diff --git a/compta/templates/compta/saisie_paiement.html b/compta/templates/compta/saisie_paiement.html index cd6526f..82c6da6 100644 --- a/compta/templates/compta/saisie_paiement.html +++ b/compta/templates/compta/saisie_paiement.html @@ -1,56 +1,37 @@ - - - - - -JB Compta — Saisie +{% extends "compta/base.html" %} +{% block titre %}Saisir{% endblock %} + +{% block extrastyle %} - - +{% endblock %} + +{% block topbar %}

Saisie d'une opération

-
Montant négatif = dépense · positif = vente/encaissement. - · ← Tableau de bord · Importer un relevé
- +
Montant négatif = dépense · positif = vente / encaissement.
{% if messages %}{% for m in messages %}
{{ m }}
{% endfor %}{% endif %} +{% endblock %} +{% block content %} +
{% csrf_token %}
@@ -77,9 +58,10 @@
- + - + +{% endblock %} - - - +{% block scripts %} + +{% endblock %} diff --git a/compta/views_gestion.py b/compta/views_gestion.py index 0b5d053..8854ff2 100644 --- a/compta/views_gestion.py +++ b/compta/views_gestion.py @@ -204,10 +204,24 @@ def _traiter_post(request): if entreprise is None: return redirect(reverse("gestion")) action = request.POST.get("action") + modeles = {"recette": Facture, "depense": Depense, "operation": Paiement} + + if action == "delete_bulk": + n = 0 + for token in request.POST.getlist("sel"): + t, _, pk = token.partition(":") + Mod = modeles.get(t) + if not Mod or not pk: + continue + obj = Mod.objects.filter(entreprise=entreprise, pk=pk).first() + if obj: + obj.delete() + n += 1 + messages.success(request, f"{n} opération(s) supprimée(s).") + return _retour(request, entreprise) + typ = request.POST.get("type") oid = request.POST.get("id") - - modeles = {"recette": Facture, "depense": Depense, "operation": Paiement} Modele = modeles.get(typ) if not Modele: return _retour(request, entreprise) diff --git a/compta/views_import.py b/compta/views_import.py index b5e0054..258690d 100644 --- a/compta/views_import.py +++ b/compta/views_import.py @@ -302,7 +302,7 @@ def import_csv(request): ctx = {"entreprises": entreprises, "categories": Categorie.objects.filter(actif=True), "activites": Activite.choices, "regimes": RegimeTva.choices, - "annee_defaut": date_cls.today().year} + "annee_defaut": date_cls.today().year, "vue": "import"} if request.method != "POST": return render(request, "compta/import_csv.html", ctx) diff --git a/compta/views_saisie.py b/compta/views_saisie.py index d4d31a5..32c786d 100644 --- a/compta/views_saisie.py +++ b/compta/views_saisie.py @@ -45,6 +45,7 @@ def _context(entreprises, post=None): "categories_vente": Categorie.objects.filter(actif=True, usage__in=["vente", "neutre"]), "today": date.today().isoformat(), "post": post, + "vue": "saisie", }