api.services.ultimate3000.airtable

Airtable side of the UltiMate 3000 estimations: Personne + Entreprise (existing CRM tables) and a dedicated table.

Estimations never go to “Propositions de reprises” / “Équipements”: they are a separate thing (the offer may be built differently later). The table is created in whatever base AIRTABLE_BASE_ID points to (dev base in development): uv run python -m scripts.ultimate3000 ensure-schema.

Attributes

Functions

ensure_schema() → list[str]

Creates the estimations table, or adds the fields it lacks. Idempotent; returns what it created.

upsert_entreprise(e) → str

By SIRET when given, else by exact name; created otherwise. Existing CRM data is never

upsert_personne(c, entreprise_id) → str

By email; only empty fields are filled on an existing Personne, and the Entreprise link is

record_url(record_id) → str

Link the sales team opens from the e-mail (Airtable needs the table id in record URLs).

modules_text(lines) → str

create_estimation(est, client, personne_id, ...) → str

attach_image(record_id, png) → None

Module Contents

api.services.ultimate3000.airtable.logger
api.services.ultimate3000.airtable.ESTIMATIONS_TABLE = 'Estimations Thermo Fisher U3000'
api.services.ultimate3000.airtable.STATUTS = ['Estimée', 'Offre envoyée', 'Acceptée', 'Refusée']
api.services.ultimate3000.airtable.FIELDS: dict[str, dict[str, Any]]
api.services.ultimate3000.airtable.LOGISTIQUE
api.services.ultimate3000.airtable.ETAT
api.services.ultimate3000.airtable.ensure_schema() → list[str]

Creates the estimations table, or adds the fields it lacks. Idempotent; returns what it created.

api.services.ultimate3000.airtable.upsert_entreprise(e: dict[str, Any]) → str

By SIRET when given, else by exact name; created otherwise. Existing CRM data is never overwritten.

api.services.ultimate3000.airtable.upsert_personne(c: dict[str, Any], entreprise_id: str) → str

By email; only empty fields are filled on an existing Personne, and the Entreprise link is added.

api.services.ultimate3000.airtable.record_url(record_id: str) → str

Link the sales team opens from the e-mail (Airtable needs the table id in record URLs).

api.services.ultimate3000.airtable.modules_text(lines: list[dict[str, Any]]) → str
api.services.ultimate3000.airtable.create_estimation(est: dict[str, Any], client: dict[str, Any], personne_id: str, entreprise_id: str, link: str) → str
api.services.ultimate3000.airtable.attach_image(record_id: str, png: bytes) → None