Skip to content

Subscription Integration

1. Subscription Fields

The DB Filter module extends sadeem.subscription with deployment-specific fields.

  1. Subscription Type - Set to DbFilter
  2. DB Filter Server - Assigned server (tracked, readonly after draft)
  3. DB Filter Server Group - Server group for auto-selection (tracked)
  4. Subscription Password - Auto-generated 6-digit admin password (readonly)

2. Deployment Flow

Server Group → Best Server → Create Database → DNS/Nginx → Running
  1. When the Server Group field changes, the system calls get_best_server() to auto-populate:
    • DB Filter Server, Server IP, HTTP/WebSocket ports
    • Main domain, subdomain prefix
    • Cloudflare settings (if enabled on server)
    • Nginx server and certificate
    • Odoo version
  2. On Run Subscription, the system:
    • Generates a 6-digit random admin password
    • Sends a POST request to the server's create database endpoint
    • Creates the Cloudflare DNS record and Nginx proxy host
    • Transitions to Running state

Template Mode

If a Database Template is set on the subscription, the system skips the standard database creation API call and instead uses the template restore mechanism from the parent module.


3. Automatic Creation from Invoices

When an invoice containing SAAS DB Filter products is posted, subscriptions are created automatically.

  1. Invoice is posted with create_saas_subscription flag
  2. System identifies products where saas_service = True and saas_subscription_type = dbfilter
  3. Creates one combined subscription for all SAAS products in the invoice
  4. Merges all saas_package IDs from all products (deduplicated)
  5. Uses the product's dbfilter_saas_server_group to select the best server
  6. Confirms the subscription and queues action_run_subscription() asynchronously
  7. Posts success/failure messages to the invoice chatter

4. Product Configuration

Products can be configured as DB Filter SAAS services.

  1. SAAS Service - Mark as a SAAS product (Boolean)
  2. Subscription Type - Set to DbFilter
  3. DB Filter Server Group - Server group for auto-assignment (required for DB Filter type)

5. Portal Extension

The customer portal is extended with a Connect As feature that allows customers to retrieve login credentials and access their DB Filter subscription directly.