Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions dashboard/src/components/AlertAddPaymentMode.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<template>
<AlertBanner
:title="
title ??
'Add a payment mode to start creating sites, benches, and more.'
title ?? 'Add a payment mode to start creating sites, benches, and more.'
"
:type="type ?? 'warning'"
>
Expand All @@ -26,7 +25,7 @@ export default {
this.$team.reload();

this.$router.push({
name: 'Welcome',
name: 'BillingOverview',
});
},
},
Expand Down
13 changes: 2 additions & 11 deletions press/press/doctype/team/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,23 +1031,14 @@ def can_create_site(self): # noqa: C901
allow = (True, "")

if not self.enabled:
why = "You cannot create a new site because your account is disabled"
why = "You cannot create a new site as your account is disabled"
return (False, why)

if self.free_account or self.parent_team or self.billing_team:
return allow

if self.is_saas_user and not self.payment_mode:
if not frappe.db.get_all("Site", {"team": self.name}, limit=1):
return allow
why = "You have already created trial site in the past"

# allow user to create their first site without payment method
if not frappe.db.get_all("Site", {"team": self.name}, limit=1):
return allow

if not self.payment_mode:
why = "You cannot create a new site because your account doesn't have a valid payment method."
why = "You cannot create a new site without setting a valid payment method."
return (False, why)

if self.payment_mode == "Prepaid Credits":
Expand Down
Loading