Separate client service subscriptions from engagement instances

This commit is contained in:
A R R R Associates
2026-08-05 13:42:11 +05:30
parent 3bba0c1e32
commit 0e9eb2bef2
11 changed files with 273 additions and 2 deletions
@@ -10,6 +10,7 @@ from app.core.templating import templates
from app.modules.services.models import ClientServiceSubscription
from app.modules.services.client_services import (
SUBSCRIPTION_STATUSES,
attach_engagement_to_plan,
get_enabled_firm_service,
get_existing_subscription,
get_subscription,
@@ -216,6 +217,12 @@ def subscription_create_submit(
row.remarks = remarks.strip() or None
row.is_active = is_active is not None
row.updated_by_user_id = user.id
client = db.get(__import__("app.modules.clients.models", fromlist=["Client"]).Client, client_id)
if client is not None:
attach_engagement_to_plan(
db, engagement=row, client=client, catalogue=firm_selection.catalogue,
firm_selection=firm_selection, actor_user_id=user.id,
)
db.commit()
db.refresh(row)