add dolibarr-payments-state skill for cash receipt tracking

V2 in the dolibarr-* family. Three workflows:

- km-payment-state.sh: per-invoice reconciliation (TTC vs sum of
  payments) with OK / PARTIAL / UNPAID / OVERPAID classification.
  More honest than the `paye` boolean for deferred-cycle agreements.
- km-payment-timeline.sh: all KM payments sorted by date with
  cumulative balance — the foundation for cohort-review deferred
  9-month-cycle tracking (actual cash receipts vs contractual schedule).
- payments-by-month.sh: monthly aggregation, KM-scoped by default
  or --all-clients for accounting basis.

Also updates dolibarr/SKILL.md endpoint catalogue with
/invoices/{id}/payments (note the date-as-string vs unix-epoch quirk)
and /bankaccounts, plus captures the corresponding examples.

V1 baseline of live data: KM is fully reconciled across 5 invoices
(1 avoir + 4 regular), 8160 € total cash receipts spread Feb/Mar/Apr 2026,
all on WISE EURO (BE).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-28 18:52:48 +02:00
parent 00ddf41f5c
commit e7abfd5e22
10 changed files with 844 additions and 1 deletions

View File

@@ -0,0 +1,371 @@
[
{
"module": null,
"id": "1",
"entity": null,
"import_key": null,
"array_options": [],
"array_languages": null,
"contacts_ids": null,
"contacts_ids_internal": null,
"linkedObjectsIds": null,
"canvas": null,
"fk_project": null,
"contact_id": null,
"user": null,
"origin_type": null,
"origin_id": null,
"ref": "QON1",
"ref_ext": null,
"statut": null,
"status": "0",
"country_id": "1",
"country_code": "FR",
"state_id": "378",
"region_id": null,
"barcode_type": null,
"barcode_type_coder": null,
"mode_reglement_id": null,
"cond_reglement_id": null,
"demand_reason_id": null,
"transport_mode_id": null,
"shipping_method_id": null,
"shipping_method": null,
"fk_multicurrency": null,
"multicurrency_code": null,
"multicurrency_tx": null,
"multicurrency_total_ht": null,
"multicurrency_total_tva": null,
"multicurrency_total_localtax1": null,
"multicurrency_total_localtax2": null,
"multicurrency_total_ttc": null,
"last_main_doc": null,
"fk_account": null,
"note_public": null,
"note_private": null,
"total_ht": null,
"total_tva": null,
"total_localtax1": null,
"total_localtax2": null,
"total_ttc": null,
"lines": null,
"actiontypecode": null,
"name": null,
"lastname": null,
"firstname": null,
"civility_id": null,
"civility_code": null,
"date_creation": 1769886460,
"date_validation": null,
"date_modification": 1769882860,
"tms": null,
"date_cloture": null,
"user_author": null,
"user_creation": null,
"user_creation_id": null,
"user_valid": null,
"user_validation": null,
"user_validation_id": null,
"user_closing_id": null,
"user_modification": null,
"user_modification_id": null,
"fk_user_creat": null,
"fk_user_modif": null,
"specimen": 0,
"totalpaid": null,
"extraparams": [],
"product": null,
"cond_reglement_supplier_id": null,
"deposit_percent": null,
"retained_warranty_fk_cond_reglement": null,
"warehouse_id": null,
"label": "QONTO",
"courant": "1",
"type": "1",
"bank": "QONTO",
"clos": "0",
"rappro": "1",
"url": "qonto.com",
"code_banque": "16958",
"code_guichet": "00001",
"number": "90485256392",
"cle_rib": "15",
"bic": "QNTOFRP1XXX",
"iban": "FR7616958000019048525639215",
"iban_prefix": null,
"pti_in_ctti": "0",
"proprio": "ARCODANGE",
"owner_name": "ARCODANGE",
"owner_address": "73 boulevard de l'yerres",
"owner_zip": "91000",
"owner_town": "Courcouronnes",
"owner_country_id": "1",
"owner_country_code": null,
"domiciliation": null,
"address": "Qonto (Olinda SAS), 18 rue de Navarin, 75009 Paris, France",
"type_lib": [
"BankType0",
"BankType1",
"BankType2"
],
"account_number": "51211",
"fk_accountancy_journal": "9",
"accountancy_journal": "BQ1",
"currency_code": "EUR",
"account_currency_code": "EUR",
"min_allowed": "0",
"min_desired": "0",
"comment": "&nbsp;<br />\r\nPour recevoir des&nbsp;virements internationaux, utilisez le BIC de notre banque interm&eacute;diaire:<br />\r\n<br />\r\nTRWIBEB3XXX<br />\r\n<br />\r\n<br />\r\n<br />\r\n(Privil&eacute;gier Wise)<br />\r\n&nbsp;",
"date_solde": null,
"solde": null,
"balance": 5032,
"ics": "",
"ics_transfer": ""
},
{
"module": null,
"id": "2",
"entity": null,
"import_key": null,
"array_options": [],
"array_languages": null,
"contacts_ids": null,
"contacts_ids_internal": null,
"linkedObjectsIds": null,
"canvas": null,
"fk_project": null,
"contact_id": null,
"user": null,
"origin_type": null,
"origin_id": null,
"ref": "WIS2",
"ref_ext": null,
"statut": null,
"status": "0",
"country_id": "2",
"country_code": "BE",
"state_id": "140",
"region_id": null,
"barcode_type": null,
"barcode_type_coder": null,
"mode_reglement_id": null,
"cond_reglement_id": null,
"demand_reason_id": null,
"transport_mode_id": null,
"shipping_method_id": null,
"shipping_method": null,
"fk_multicurrency": null,
"multicurrency_code": null,
"multicurrency_tx": null,
"multicurrency_total_ht": null,
"multicurrency_total_tva": null,
"multicurrency_total_localtax1": null,
"multicurrency_total_localtax2": null,
"multicurrency_total_ttc": null,
"last_main_doc": null,
"fk_account": null,
"note_public": null,
"note_private": null,
"total_ht": null,
"total_tva": null,
"total_localtax1": null,
"total_localtax2": null,
"total_ttc": null,
"lines": null,
"actiontypecode": null,
"name": null,
"lastname": null,
"firstname": null,
"civility_id": null,
"civility_code": null,
"date_creation": 1769887227,
"date_validation": null,
"date_modification": 1769883627,
"tms": null,
"date_cloture": null,
"user_author": null,
"user_creation": null,
"user_creation_id": null,
"user_valid": null,
"user_validation": null,
"user_validation_id": null,
"user_closing_id": null,
"user_modification": null,
"user_modification_id": null,
"fk_user_creat": null,
"fk_user_modif": null,
"specimen": 0,
"totalpaid": null,
"extraparams": [],
"product": null,
"cond_reglement_supplier_id": null,
"deposit_percent": null,
"retained_warranty_fk_cond_reglement": null,
"warehouse_id": null,
"label": "WISE EURO",
"courant": "1",
"type": "1",
"bank": "WISE",
"clos": "0",
"rappro": "1",
"url": "https://wise.com",
"code_banque": "",
"code_guichet": "",
"number": "",
"cle_rib": "",
"bic": "TRWIBEB1XXX",
"iban": "BE58967543094979",
"iban_prefix": null,
"pti_in_ctti": "0",
"proprio": "ARCODANGE",
"owner_name": "ARCODANGE",
"owner_address": "73 BD de l'yerres",
"owner_zip": "91000",
"owner_town": "\u00c9vry-Courcouronnes",
"owner_country_id": "1",
"owner_country_code": null,
"domiciliation": null,
"address": "Wise, Rue du Tr\u00f4ne 100, 3rd floor, Brussels, 1050, Belgium",
"type_lib": [
"BankType0",
"BankType1",
"BankType2"
],
"account_number": "51212",
"fk_accountancy_journal": "8",
"accountancy_journal": "BQ2",
"currency_code": "EUR",
"account_currency_code": "EUR",
"min_allowed": "0",
"min_desired": "0",
"comment": "",
"date_solde": null,
"solde": null,
"balance": 3160,
"ics": "",
"ics_transfer": ""
},
{
"module": null,
"id": "3",
"entity": null,
"import_key": null,
"array_options": [],
"array_languages": null,
"contacts_ids": null,
"contacts_ids_internal": null,
"linkedObjectsIds": null,
"canvas": null,
"fk_project": null,
"contact_id": null,
"user": null,
"origin_type": null,
"origin_id": null,
"ref": "CCA1",
"ref_ext": null,
"statut": null,
"status": "0",
"country_id": "1",
"country_code": "FR",
"state_id": null,
"region_id": null,
"barcode_type": null,
"barcode_type_coder": null,
"mode_reglement_id": null,
"cond_reglement_id": null,
"demand_reason_id": null,
"transport_mode_id": null,
"shipping_method_id": null,
"shipping_method": null,
"fk_multicurrency": null,
"multicurrency_code": null,
"multicurrency_tx": null,
"multicurrency_total_ht": null,
"multicurrency_total_tva": null,
"multicurrency_total_localtax1": null,
"multicurrency_total_localtax2": null,
"multicurrency_total_ttc": null,
"last_main_doc": null,
"fk_account": null,
"note_public": null,
"note_private": null,
"total_ht": null,
"total_tva": null,
"total_localtax1": null,
"total_localtax2": null,
"total_ttc": null,
"lines": null,
"actiontypecode": null,
"name": null,
"lastname": null,
"firstname": null,
"civility_id": null,
"civility_code": null,
"date_creation": 1772107398,
"date_validation": null,
"date_modification": 1772103843,
"tms": null,
"date_cloture": null,
"user_author": null,
"user_creation": null,
"user_creation_id": null,
"user_valid": null,
"user_validation": null,
"user_validation_id": null,
"user_closing_id": null,
"user_modification": null,
"user_modification_id": null,
"fk_user_creat": null,
"fk_user_modif": null,
"specimen": 0,
"totalpaid": null,
"extraparams": [],
"product": null,
"cond_reglement_supplier_id": null,
"deposit_percent": null,
"retained_warranty_fk_cond_reglement": null,
"warehouse_id": null,
"label": "G.RADUREAU Compte Courant Asso",
"courant": "1",
"type": "1",
"bank": "",
"clos": "0",
"rappro": "1",
"url": null,
"code_banque": "",
"code_guichet": "",
"number": "",
"cle_rib": "",
"bic": "",
"iban": "",
"iban_prefix": null,
"pti_in_ctti": "0",
"proprio": "",
"owner_name": "",
"owner_address": "",
"owner_zip": "",
"owner_town": "",
"owner_country_id": null,
"owner_country_code": null,
"domiciliation": null,
"address": "",
"type_lib": [
"BankType0",
"BankType1",
"BankType2"
],
"account_number": "45511",
"fk_accountancy_journal": "13",
"accountancy_journal": "CCA1",
"currency_code": "EUR",
"account_currency_code": "EUR",
"min_allowed": "0",
"min_desired": "0",
"comment": "",
"date_solde": null,
"solde": null,
"balance": -429.75,
"ics": "",
"ics_transfer": ""
}
]

View File

@@ -0,0 +1,12 @@
[
{
"amount": "5100.00000000",
"type": "VIR",
"typeline": "payment",
"date": "2026-03-12 12:00:00",
"num": "",
"ref": "REC003-CL00002",
"ref_ext": "",
"fk_bank_line": "19"
}
]