Skip to content

Commit

Permalink
Merge pull request #33498 from dimagi/jc/show-software-plan-version
Browse files Browse the repository at this point in the history
Show software plan version in the list of subscriptions
  • Loading branch information
jingcheng16 authored Sep 20, 2023
2 parents b8ed9f5 + ab39e3d commit 48d1df0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
29 changes: 13 additions & 16 deletions corehq/apps/accounting/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def _subscription_to_row(subscription):
),
sort_key=subscription.account.name,
),
subscription.plan_version.plan.name,
subscription.plan_version,
subscription.is_active,
subscription.salesforce_contract_id,
subscription.date_start,
Expand Down Expand Up @@ -370,8 +370,8 @@ def _subscriptions(self):
filter_created_by = CreatedSubAdjMethodFilter.get_value(
self.request, self.domain)
if (
filter_created_by is not None and
filter_created_by in [s[0] for s in SubscriptionAdjustmentMethod.CHOICES]
filter_created_by is not None
and filter_created_by in [s[0] for s in SubscriptionAdjustmentMethod.CHOICES]
):
queryset = queryset.filter(
subscriptionadjustment__reason=SubscriptionAdjustmentReason.CREATE,
Expand Down Expand Up @@ -535,8 +535,8 @@ def _invoice_to_row(invoice):
WireInvoiceSummaryView, ManageBillingAccountView,
)
new_this_month = (
invoice.date_created.month == invoice.account.date_created.month and
invoice.date_created.year == invoice.account.date_created.year
invoice.date_created.month == invoice.account.date_created.month
and invoice.date_created.year == invoice.account.date_created.year
)
try:
contact_info = BillingContactInfo.objects.get(account=invoice.account)
Expand Down Expand Up @@ -702,8 +702,8 @@ def _invoice_to_row(invoice):
ManageBillingAccountView, EditSubscriptionView,
)
new_this_month = (
invoice.date_created.month == invoice.subscription.account.date_created.month and
invoice.date_created.year == invoice.subscription.account.date_created.year
invoice.date_created.month == invoice.subscription.account.date_created.month
and invoice.date_created.year == invoice.subscription.account.date_created.year
)
try:
contact_info = BillingContactInfo.objects.get(
Expand All @@ -712,10 +712,7 @@ def _invoice_to_row(invoice):
except BillingContactInfo.DoesNotExist:
contact_info = BillingContactInfo()

plan_name = "{name} v{version}".format(
name=invoice.subscription.plan_version.plan.name,
version=invoice.subscription.plan_version.version,
)
plan_name = invoice.subscription.plan_version
plan_href = reverse(EditSubscriptionView.urlname, args=[invoice.subscription.id])
account_name = invoice.subscription.account.name
account_href = reverse(ManageBillingAccountView.urlname, args=[invoice.subscription.account.id])
Expand Down Expand Up @@ -994,8 +991,8 @@ def rows(self):
def _invoice_to_row(invoice):
from corehq.apps.accounting.views import ManageBillingAccountView
new_this_month = (
invoice.date_created.month == invoice.account.date_created.month and
invoice.date_created.year == invoice.account.date_created.year
invoice.date_created.month == invoice.account.date_created.month
and invoice.date_created.year == invoice.account.date_created.year
)
try:
contact_info = BillingContactInfo.objects.get(
Expand Down Expand Up @@ -1486,9 +1483,9 @@ def _credit_adjustments(self):
domain = DomainFilter.get_value(self.request, self.domain)
if domain is not None:
queryset = queryset.filter(
Q(credit_line__subscription__subscriber__domain=domain) |
Q(invoice__subscription__subscriber__domain=domain) |
Q(
Q(credit_line__subscription__subscriber__domain=domain)
| Q(invoice__subscription__subscriber__domain=domain)
| Q(
credit_line__subscription__isnull=True,
invoice__isnull=True,
credit_line__account__created_by_domain=domain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{% for subscription, last_due_date in subscription_list %}
<tr>
<td>{{ subscription.subscriber.domain }}</td>
<td>{{ subscription.plan_version.plan.name }}</td>
<td>{{ subscription.plan_version }}</td>
<td>{{ subscription.date_start }}</td>
<td>{{ subscription.date_end }}</td>
<td>{{ subscription.is_active }}</td>
Expand Down

0 comments on commit 48d1df0

Please sign in to comment.