Skip to content

Module Architecture

flowchart TD
    WEBSITE["sadeem_subscription_website\nWebsite Plans"]
    DBFILTER["sadeem_saas_dbfilter\nDBFilter SAAS"]

    PLAN["sadeem.subscription.plan (inherit)\nDBFilter server group field\nauto-assigns purchase to best server"]
    GRP["sadeem.dbfilter.server.group\ngroup of shared Odoo servers\nwith common defaults"]
    SRV["sadeem.dbfilter.server\nauto-selected by get_best_server()\nbased on load and capacity"]
    ORDER["sadeem.subscription.plan.order (inherit)\nmaps server group to\ndbfilter_server_group on subscription"]
    SUB["sadeem.subscription\ntype=dbfilter\nserver defaults auto-applied"]

    WEBSITE --> PLAN
    DBFILTER --> PLAN

    PLAN --> GRP
    PLAN --> A1([action_publish override\nvalidate DBFilter server group configured])

    GRP --> A2([get_best_server\nselect server by capacity])
    A2 --> SRV

    ORDER --> A3([action_create_subscription override\napply dbfilter server group to subscription])
    A3 --> SUB

    SRV --> A4([_apply_dbfilter_server_group_defaults\nset domain · Nginx · Cloudflare · backup])
    A4 --> SUB

    SUB --> A5([action_confirm\ncreate database on shared Odoo server])

    EXT[/DBFilter Slave Agent\nremote Odoo server/]
    A5 --> EXT

Module Description

SAAS Website Plans - DB Filter Extension. Adds DB Filter server group configuration to website subscription plans, enabling plan purchases to be deployed on DB Filter servers.

Dependencies

  • sadeem_subscription_website
  • sadeem_saas_dbfilter

Extension

This module extends website subscription plans with a DB Filter Server Group field. When the subscription type is set to dbfilter, the system uses the server group to auto-select the best DB Filter server for the purchased subscription.

Additional Plan Fields

  1. Subscription Type - Extended with DbFilter option
  2. DB Filter Server Group - Server group for auto-assigning subscriptions (required when type is dbfilter)

How It Works

  1. Plan is configured with type DbFilter and a server group
  2. Customer purchases the plan through the website flow
  3. After payment, get_best_server() selects the optimal server from the group
  4. All server-related fields (IP, ports, domain, Cloudflare, Nginx) are set from the selected server
  5. Subscription is created and deployed on the DB Filter server

Publishing Validation

When publishing a DB Filter plan, the system validates that a DB Filter Server Group is configured.

Key Fields

Subscription Plan — DBFilter additions (sadeem.subscription.plan inherit)

Field Type Description
saas_subscription_type Selection Extended with ('dbfilter', 'DB Filter')
dbfilter_server_group_id Many2one Server group for auto-assigning subscriptions to a DBFilter server

Key Actions

Action Model Description
_validate_publish (override) sadeem.subscription.plan Validates that dbfilter_server_group_id is configured before allowing publish when type is dbfilter
_validate_subscription_creation (override) sadeem.subscription.plan.order Validates DBFilter server group is configured on the plan
_prepare_subscription_values (override) sadeem.subscription.plan.order Adds dbfilter_saas_server_group to the subscription creation values

Warnings & Important Notes

  • Server group required to publish: _validate_publish raises ValidationError if saas_subscription_type = 'dbfilter' and no dbfilter_server_group_id is set.
  • Server group required to purchase: _validate_subscription_creation raises ValidationError if no server group is configured at creation time.
  • No new persistent models: This module only inherits and extends existing models.