diff --git a/compta/templates/compta/bookmarklet.html b/compta/templates/compta/bookmarklet.html index d6cf190..e2f2129 100644 --- a/compta/templates/compta/bookmarklet.html +++ b/compta/templates/compta/bookmarklet.html @@ -51,7 +51,7 @@ {% verbatim %} diff --git a/compta/templates/compta/import_csv.html b/compta/templates/compta/import_csv.html index 5e8ad34..cf0be07 100644 --- a/compta/templates/compta/import_csv.html +++ b/compta/templates/compta/import_csv.html @@ -87,7 +87,7 @@ - +
diff --git a/compta/views_import.py b/compta/views_import.py index 3b42c59..d6ae060 100644 --- a/compta/views_import.py +++ b/compta/views_import.py @@ -103,7 +103,7 @@ def _parse_csv(text, cats): for n, raw in enumerate(rows[start:], start=start + 1): if not any(c.strip() for c in raw): continue - c = (raw + [""] * 7)[:7] + c = (raw + [""] * 8)[:8] dt = _date(c[0]) montant = _dec(c[6]) if dt is None: @@ -111,8 +111,16 @@ def _parse_csv(text, cats): if montant == 0: erreurs.append(f"Ligne {n} : montant nul."); continue cat = cats.get((c[2] or "").strip().lower()) + grp = (c[7] or "").strip() # colonne « groupe » (ventilation), optionnelle lignes.append(_row(dt, (c[1] or "").strip() or "(sans libellé)", montant, - _dec(c[4]), _regime(c[5]), cat, _activite(c[3]), "", n)) + _dec(c[4]), _regime(c[5]), cat, _activite(c[3]), + grp, n, grp)) + # n_parts pour l'aperçu : marquer « ventilée » les lignes d'un même groupe. + from collections import Counter + nb = Counter(l["groupe"] for l in lignes if l["groupe"]) + for l in lignes: + if l["groupe"] and nb[l["groupe"]] > 1 and "ventilée" not in l["type"]: + l["type"] += " (ventilée)" return lignes, erreurs, []