diff --git a/press/press/doctype/invoice/invoice.py b/press/press/doctype/invoice/invoice.py index 3c4c0d5d6c..143c29c97c 100644 --- a/press/press/doctype/invoice/invoice.py +++ b/press/press/doctype/invoice/invoice.py @@ -506,11 +506,23 @@ def validate_dates(self): def update_item_descriptions(self): for item in self.items: - if not item.description and item.document_type == "Site" and item.plan: - site_name = item.document_name.split(".archived")[0] - plan = frappe.get_cached_value("Site Plan", item.plan, "plan_title") + if not item.description: how_many_days = f"{cint(item.quantity)} day{'s' if item.quantity > 1 else ''}" - item.description = f"{site_name} active for {how_many_days} on {plan} plan" + if item.document_type == "Site" and item.plan: + site_name = item.document_name.split(".archived")[0] + plan = frappe.get_cached_value("Site Plan", item.plan, "plan_title") + item.description = f"{site_name} active for {how_many_days} on {plan} plan" + elif item.document_type in ["Server", "Database Server"]: + server_title = frappe.get_cached_value(item.document_type, item.document_name, "title") + if item.plan == "Add-on Storage plan": + item.description = f"{server_title} Storage Add-on for {how_many_days}" + else: + item.description = f"{server_title} active for {how_many_days}" + elif item.document_type == "Marketplace App": + app_title = frappe.get_cached_value("Marketplace App", item.document_name, "title") + item.description = f"Marketplace app {app_title} active for {how_many_days}" + else: + item.description = "Prepaid Credits" def add_usage_record(self, usage_record): if self.type != "Subscription":