Skip to content

Commit

Permalink
fix(BillingInvoice): show proper titles and plan names on invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
BreadGenie committed Jun 13, 2024
1 parent 0ee5768 commit ef0bce1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions press/press/doctype/invoice/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,23 @@ def get_list_query(query, filters=None, **list_args):

def get_doc(self, doc):
doc.invoice_pdf = self.invoice_pdf or (self.currency == "USD" and self.get_pdf())
currency = frappe.get_value("Team", self.team, "currency")
price_field = "price_inr" if currency == "INR" else "price_usd"
currency_symbol = "₹" if currency == "INR" else "$"

for item in doc["items"]:
if item.document_type in ("Server", "Database Server"):
item.document_name = frappe.get_value(
item.document_type, item.document_name, "title"
)
item.plan = (
f"{currency_symbol}{frappe.get_value('Server Plan', item.plan, price_field)}"
)
elif item.document_type == "Marketplace App":
item.document_name = frappe.get_value(
item.document_type, item.document_name, "title"
)
item.plan = f"{currency_symbol}{frappe.get_value('Marketplace App Plan', item.plan, price_field)}"

@dashboard_whitelist()
def stripe_payment_url(self):
Expand Down

0 comments on commit ef0bce1

Please sign in to comment.