New Pricing model with Catalog from Website #459
No reviewers
Labels
No labels
API
Billing
UI/UX
dependencies
bug
change
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
servala/servala-portal!459
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "catalog-website-sync"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Replace the Odoo-centric billing model with a catalog-based billing system synced from the Servala website. This decouples the portal from Odoo for pricing data and introduces a structured, decomposed pricing model with SLA tiers, progressive discounts, and per-component pricing.
Models removed
OdooObjectCache- Generic cache for Odoo API responses (product IDs, pricing). No longer needed as pricing data now comes from the Servala website catalog API instead of Odoo. And it was nowhere used.ServiceDefinition.billing_config(JSONField) - Free-form JSON that defined billing annotation items withproductIDSource/valuePath. Replaced by the structuredServiceComponentSpecmodel.ComputePlanAssignment.sla,.odoo_product_id,.price,.unit,.minimum_service_size- Pricing, SLA, and Odoo product references moved out of the availability junction table into dedicated catalog models.ComputePlanAssignmentis now purely an availability mapping (which compute plans are offered on which control plane CRD).Models added (in
billing_catalog.py)SLATier- Defines SLA levels (e.g. No SLA, BH 99.9%, 99.9% 24/7) with uptime percentage, HA replica minimums, and K8sserviceLevelvalue. Replaces the hardcodedSLA_CHOICESonComputePlanAssignment.ServicePricingConfig- Per-service pricing configuration: base fee, currency, billing unit, minimum units.ServiceSLASurcharge- SLA-specific fixed surcharge amounts per service.ComputePlanCatalogEntry- Hourly pricing for each compute plan per service, synced from the catalog. UsesDecimalFieldforram_gibto support fractional values (e.g. 512Mi = 0.5 GiB).StorageCatalogEntry- Per-GiB storage pricing per service.ProgressiveDiscountBracket- Per-service volume discount tiers (each bracket is linked to a specific service via FK).ServiceComponentSpec- Defines billing annotation structure per service (replacesbilling_configJSON), including value paths, product IDs, and sizing units.AdditionalCSPResource- Cloud-provider-specific resources with custom pricing (e.g. provider surcharges).CatalogSyncedMixin(abstract) - Addslast_synced_atandis_stalefields with aNonStaleManagerthat filters out stale records.Other notable changes
Service.listedfield - Boolean to hide services from the catalog (e.g. services used only as supporting services).ServiceInstance.sla_tier- New FK toSLATier, replacing the SLA stored onComputePlanAssignment.sync_plan_catalogmanagement command - Syncs the full billing catalog from the Servala website API, creating/updating all catalog models and marking removed entries as stale.core/utils/pricing.py) - Billing annotation builder and price calculator for the new decomposed pricing model.OrganizationInvoiceListViewand related templates/URLs removed (Odoo invoice listing no longer supported).Migrations
3 consolidated migrations (0041-0043):
OdooObjectCache,billing_config, oldComputePlanAssignmentcolumns), deduplicatesComputePlanAssignmentrows, migratesbilling_configJSON toServiceComponentSpecrows, and addsService.listedfieldsla_tieron existingServiceInstancerecordsProgressiveDiscountBracketfrom global to per-service (addsserviceFK) and changesComputePlanCatalogEntry.ram_gibfrom integer to decimal (supports sub-GiB plans like 512Mi)Rollout / Upgrade process
Before deploying: Ensure the Servala website catalog API is available and credentials are configured:
SERVALA_WEBSITE_URLSERVALA_WEBSITE_USERNAMESERVALA_WEBSITE_PASSWORDRun migrations:
just run migrate- This will:sla_tieron all existing service instancesComputePlanAssignmentrows (collapse SLA variants)billing_configJSON data intoServiceComponentSpecrowsOdooObjectCachetable and remove old fieldsRun initial catalog sync:
just run sync_plan_catalog- This populates all pricing data from the website. Without this, the plan selection UI will show no pricing information.Verify: Check that the plan selection UI shows correct pricing and SLA options for existing services.
Set up recurring sync: Schedule
sync_plan_catalogto run periodically (e.g. via cron) to keep pricing data up to date.343ced743ae8a6d76192e8fa23ded60d3e8f0da4WIP: Sync functionality from catalog APIto WIP: New Pricing model with Catalog from Website1dac0ab71b975d169c0252f4029347798053d216WIP: New Pricing model with Catalog from Websiteto New Pricing model with Catalog from Website