:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(projects): skip billing checks when other projects remain (#123356)
Pawel Cebula93444bcb33ee
diff --git a/posthog/api/project.py b/posthog/api/project.pyindex d3038e204a49..e52ce6ae7240 100644--- a/posthog/api/project.py+++ b/posthog/api/project.py@@ -1745,7 +1745,8 @@ class ProjectViewSet(license = get_cached_instance_license()try:has_active_subscription = (- settings.EE_AVAILABLE+ is_last_project+ and settings.EE_AVAILABLEand is_cloud()and licenseand BillingManager(license).get_billing(project.organization).get("has_active_subscription")diff --git a/posthog/api/test/test_project.py b/posthog/api/test/test_project.pyindex 0db6612dfe53..5a4cedb2366a 100644--- a/posthog/api/test/test_project.py+++ b/posthog/api/test/test_project.py@@ -663,6 +663,8 @@ class TestProjectAPI(team_api_test_factory()): # type: ignoreresponse = self.client.delete(f"/api/projects/{self.project.id}")self.assertEqual(response.status_code, expected_status)+ if project_count > 1:+ mock_get_billing.assert_not_called()if expected_status == status.HTTP_400_BAD_REQUEST:self.assertIn("active subscription", response.json()["detail"])self.assertTrue(Project.objects.filter(id=self.project.id).exists())