--- name: dolibarr-thirdparty-completeness description: Audit the completeness of any Arcodange Dolibarr thirdparty (client or supplier) against country-specific French / EU / extra-EU rules. Two workflows — (1) audit one thirdparty by socid (generalized from the V1 KissMetrics-only audit), with country-aware checklist : FR requires SIREN + SIRET + tva_intra (if VAT-registered), EU non-FR requires tva_intra for B2B autoliquidation, extra-EU requires a national tax id in idprof1; (2) audit ALL visible thirdparties in one shot, compact table showing each one's mandatory gaps and exit code reflecting whether the dataset is fully compliant. Use when the user asks "audit fiche client", "audit fiche fournisseur", "complétude des tiers", "qui n'a pas son SIRET / TVA intra", "qualité des données tiers Dolibarr". Supersedes the V1 dolibarr-invoice-audit/scripts/audit-km-thirdparty.sh (KM-hardcoded) by handling any socid and any country. Depends on the `dolibarr` skill. SKIP for write/correction tasks (use the Dolibarr UI), for invoice-side mandatory mentions (handled by `dolibarr-invoice-audit`), and for TVA computation (handled by `dolibarr-tva-reconciliation` / `dolibarr-tva-deductible`). requires: bins: ["curl", "jq", "python3"] auth: true --- # dolibarr-thirdparty-completeness — generalized thirdparty audit Replaces the V1 KM-only `dolibarr-invoice-audit/scripts/audit-km-thirdparty.sh` with a generalized, country-aware audit that scales as Arcodange adds more clients and suppliers. Depends on the [dolibarr](../dolibarr/SKILL.md) base skill. ## The country-aware checklist | Country | Mandatory | Optional but useful | |---|---|---| | **FR** | name, address, zip, town, country_code, **SIREN** (idprof1), **SIRET** (idprof2), **tva_intra** (if supplier or VAT-registered) | APE (idprof3), email, phone, url, IBAN | | **EU non-FR** | name, address, zip, town, country_code, **tva_intra** (required for B2B autoliquidation under article 196 directive TVA) | national registration id (idprof1), email, phone, url | | **Extra-EU** | name, address, zip, town, country_code, **national tax id** (idprof1 — EIN for US, equivalent elsewhere) | idprof2, email, phone, url | The rules mirror the field a French accountant would expect to file on monthly TVA declarations and on the customer file as audit evidence. ## Workflow 1 — Audit one thirdparty ```bash ./scripts/audit-thirdparty.sh 1 # KissMetrics (US, client) ./scripts/audit-thirdparty.sh 2 # Wise Europe SA (BE, supplier) ./scripts/audit-thirdparty.sh 5 # Medialex (FR, supplier) echo "exit: $?" # 0 = complete, 1 = mandatory gap ``` Live output for the FR-supplier case (captured at [examples/audit-thirdparty-5.txt](examples/audit-thirdparty-5.txt)): ``` ================================================================================ Thirdparty 5 — Medialex [supplier, country=FR] ================================================================================ [OK] name = 'Medialex' [OK] address = '10 rue du Breil' [OK] zip = '35063' [OK] town = 'Rennes' [OK] country_code = 'FR' [OK] idprof1 (SIREN) = '353403074' [XX] idprof2 (SIRET) = '' [OK] idprof3 (APE) = '7312Z' (optional) [XX] tva_intra (VAT) = '' ... 8 pass, 2 mandatory fail(s), 2 optional unset ``` Status codes: - `[OK]` — value present. - `[XX]` — mandatory and missing. - `[--]` — optional and unset. ## Workflow 2 — Audit all visible thirdparties ```bash ./scripts/audit-all-thirdparties.sh # everyone ./scripts/audit-all-thirdparties.sh --clients-only ./scripts/audit-all-thirdparties.sh --suppliers-only echo "exit: $?" # 0 if dataset is fully compliant ``` Live output (captured at [examples/audit-all-thirdparties.txt](examples/audit-all-thirdparties.txt)) — **5 / 10 thirdparties have mandatory gaps**: ``` id name cnty role missing -------------------------------------------------------------------------------------------------------------- 1 KissMetrics US client tax_id 2 Wise Europe SA BE supplier tva_intra 3 Greffe du tribunal de commerce Évry FR supplier (complete) 4 YOLAW FR supplier (complete) 5 Medialex FR supplier SIRET, tva_intra 6 Qonto FR supplier SIRET 7 OVH FR supplier (complete) 8 La Poste FR supplier (complete) 9 Infogreffe FR supplier SIRET 10 Darnis Operations FR supplier (complete) -------------------------------------------------------------------------------------------------------------- # 10 thirdparties audited, 5 with mandatory gaps ``` The 5 gaps to surface to the cohort review / accountant: - **KissMetrics**: US tax id (EIN) — already known from V1, still pending. - **Wise Europe SA**: BE tva_intra missing (mandatory for intra-UE B2B autoliquidation; currently the FAF2026001 supplier invoice is recorded with TVA=0 but no tva_intra, which the accountant will flag). - **Medialex**: SIRET + tva_intra. SIREN is present so the SIRET should be derivable (SIRET = SIREN + 5-digit NIC). The tva_intra is FR + 2 chars + SIREN. - **Qonto, Infogreffe**: SIRET missing on otherwise-complete records. Fixing these is a Dolibarr UI task — this skill is read-only. ## Relationship with V1 The V1 `dolibarr-invoice-audit/scripts/audit-km-thirdparty.sh` is kept for backward compatibility but is now a special case of this skill. Recommendation: invoke `./scripts/audit-thirdparty.sh 1` from this skill instead of the V1 script for any new automation. ## Out of scope - **Writes / corrections.** The API key is read-only. Fix via the Dolibarr UI. - **VAT-number validation** against the EU VIES service. Future enhancement: `tva_intra` could be looked up against `https://ec.europa.eu/taxation_customs/vies/services/checkVatService` to validate the number. Out of scope here (external API). - **idprof normalization across forks** of Dolibarr. The idprof1..6 slots can be reordered or relabeled by Dolibarr admins. This skill assumes the stock French Dolibarr mapping (idprof1=SIREN, idprof2=SIRET, idprof3=APE).