scripts.airtable.variation_pricing_migration¶
One-time migration to variation-level prices. Run it BEFORE “Prix de vente HT” (Toutes les unités) becomes a formula: it reads that column’s current hand-typed values.
“Neuf déclassé” units with no “Prix déclassé HT”: copied from their “Prix de vente HT”.
Variations with no “Prix de la variation”: the highest “Prix de vente HT” of their “Très bon” units for sale (A vendre / En enchères); with none for sale, of all their “Très bon” units. With no “Très bon” price, the same from their units with no “Etat esthétique”, then “Neuf”, then “Bon” and “Abimé” through the grid reversed (so those units keep their price).
Every priced Variation: “Prix bon état €HT” / “Prix abimé €HT” from the discount grid.
Dry run by default (prints what would change); –apply writes to the Airtable base in .env.
Usage: uv run python -m scripts.airtable.variation_pricing_migration [–apply]
Attributes¶
Functions¶
|
|
|
Variation id -> (Variation price from its highest-priced units, their condition). |
|
Variation price where it has none, from its units (SOURCE_CONDITIONS order). |
|
Module Contents¶
- scripts.airtable.variation_pricing_migration.UNIT_PRICE = 'Prix de vente HT'¶
- scripts.airtable.variation_pricing_migration.UNIT_DECLASSE_PRICE = 'Prix déclassé HT'¶
- scripts.airtable.variation_pricing_migration.UNIT_FIELDS¶
- scripts.airtable.variation_pricing_migration.declasse_updates(units: list[dict[str, Any]]) list[dict[str, Any]]¶
- scripts.airtable.variation_pricing_migration.SOURCE_CONDITIONS = ('Très bon', '', 'Neuf', 'Bon', 'Abimé')¶
- scripts.airtable.variation_pricing_migration.variation_price_sources(units: list[dict[str, Any]], grid: api.services.pricing.PricingGrid) dict[str, tuple[float, str]]¶
Variation id -> (Variation price from its highest-priced units, their condition).
- scripts.airtable.variation_pricing_migration.missing_variation_prices(variations: list[dict[str, Any]], units: list[dict[str, Any]], grid: api.services.pricing.PricingGrid) list[dict[str, Any]]¶
Variation price where it has none, from its units (SOURCE_CONDITIONS order).
- scripts.airtable.variation_pricing_migration.main() int¶