Arrondi URSSAF/TVA/VFL a l'euro + CFP + fix montant popup + fix categorie favori
Deploy via Portainer / deploy (push) Successful in 0s
Deploy via Portainer / deploy (push) Successful in 0s
This commit is contained in:
@@ -99,6 +99,8 @@ def _parse_csv(text, cats):
|
||||
delim = ";" if text.count(";") >= text.count(",") else ","
|
||||
rows = list(csv.reader(io.StringIO(text), delimiter=delim))
|
||||
lignes, erreurs = [], []
|
||||
# Résolution par numéro de compte PCG (favori Indy) OU par nom (CSV manuel).
|
||||
compte_map = {c.compte_pcg: c for c in Categorie.objects.all() if c.compte_pcg}
|
||||
start = 1 if rows and rows[0] and rows[0][0].strip().lower() == "date" else 0
|
||||
for n, raw in enumerate(rows[start:], start=start + 1):
|
||||
if not any(c.strip() for c in raw):
|
||||
@@ -110,7 +112,8 @@ def _parse_csv(text, cats):
|
||||
erreurs.append(f"Ligne {n} : date invalide « {c[0]} »."); continue
|
||||
if montant == 0:
|
||||
erreurs.append(f"Ligne {n} : montant nul."); continue
|
||||
cat = cats.get((c[2] or "").strip().lower())
|
||||
val = (c[2] or "").strip()
|
||||
cat = compte_map.get(val) or cats.get(val.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]),
|
||||
|
||||
Reference in New Issue
Block a user