+
+ Select a site to get started
+
+
-
@@ -120,18 +128,7 @@
-
- Select a site to get started
-
-
- Setting Up SQL Playground
-
+
1
+ ORDER BY count DESC
+ """,
+ as_dict=True,
+ )
+
+ if not data:
+ return data
+
+ result = []
+ for d in data:
+ result.append(d.subscription)
+ return result
+
def disabled_teams_with_active_sites(self):
return frappe.get_all(
"Team",
diff --git a/press/press/doctype/release_group/release_group.py b/press/press/doctype/release_group/release_group.py
index 83dd5afe16..fd6ec93e29 100644
--- a/press/press/doctype/release_group/release_group.py
+++ b/press/press/doctype/release_group/release_group.py
@@ -170,6 +170,13 @@ def get_doc(self, doc):
doc.status = self.status
doc.actions = self.get_actions()
doc.are_builds_suspended = are_builds_suspended()
+ doc.eol_versions = frappe.db.get_all(
+ "Frappe Version",
+ filters={"status": "End of Life"},
+ fields=["name"],
+ order_by="name desc",
+ pluck="name",
+ )
if len(self.servers) == 1:
server = frappe.db.get_value("Server", self.servers[0].server, ["team", "title"], as_dict=True)
diff --git a/press/press/doctype/site/site.py b/press/press/doctype/site/site.py
index 036b9e801a..63cdd02e55 100644
--- a/press/press/doctype/site/site.py
+++ b/press/press/doctype/site/site.py
@@ -250,6 +250,13 @@ def get_doc(self, doc):
doc.latest_frappe_version = frappe.db.get_value(
"Frappe Version", {"status": "Stable", "public": True}, order_by="name desc"
)
+ doc.eol_versions = frappe.db.get_all(
+ "Frappe Version",
+ filters={"status": "End of Life"},
+ fields=["name"],
+ order_by="name desc",
+ pluck="name",
+ )
doc.owner_email = frappe.db.get_value("Team", self.team, "user")
doc.current_usage = self.current_usage
doc.current_plan = get("Site Plan", self.plan) if self.plan else None
diff --git a/press/press/doctype/subscription/subscription.py b/press/press/doctype/subscription/subscription.py
index fd707a178b..d474e27c6d 100644
--- a/press/press/doctype/subscription/subscription.py
+++ b/press/press/doctype/subscription/subscription.py
@@ -7,7 +7,7 @@
import rq
from frappe.model.document import Document
from frappe.query_builder.functions import Coalesce, Count
-from frappe.utils import cint
+from frappe.utils import cint, flt
from press.overrides import get_permission_query_conditions_for_doctype
from press.press.doctype.site_plan.site_plan import SitePlan
@@ -152,7 +152,7 @@ def create_usage_record(self, date: DF.Date | None = None):
if self.additional_storage:
price = plan.price_inr if team.currency == "INR" else plan.price_usd
price_per_day = price / plan.period # no rounding off to avoid discrepancies
- amount = price_per_day * cint(self.additional_storage)
+ amount = flt((price_per_day * cint(self.additional_storage)), 2)
else:
amount = plan.get_price_for_interval(self.interval, team.currency)
diff --git a/press/press/doctype/usage_record/usage_record.py b/press/press/doctype/usage_record/usage_record.py
index 128cfedee2..10aedfc8d1 100644
--- a/press/press/doctype/usage_record/usage_record.py
+++ b/press/press/doctype/usage_record/usage_record.py
@@ -87,7 +87,6 @@ def validate_duplicate_usage_record(self):
"plan": self.plan,
"docstatus": 1,
"subscription": self.subscription,
- "invoice": self.invoice,
},
pluck="name",
)
diff --git a/press/press/report/mariadb_locks_list/mariadb_locks_list.py b/press/press/report/mariadb_locks_list/mariadb_locks_list.py
index 36f142ce92..5f804d0926 100644
--- a/press/press/report/mariadb_locks_list/mariadb_locks_list.py
+++ b/press/press/report/mariadb_locks_list/mariadb_locks_list.py
@@ -7,7 +7,7 @@
def execute(filters=None):
- frappe.only_for("System Manager")
+ frappe.only_for(("System Manager", "Support Team"))
data = get_data(filters)
return get_columns(), data
@@ -20,8 +20,7 @@ def get_data(filters):
"private_ip": server.private_ip,
"mariadb_root_password": server.get_password("mariadb_root_password"),
}
- rows = agent.post("database/locks", data=data)
- return rows
+ return agent.post("database/locks", data=data)
def get_columns():