Skip to content

Commit

Permalink
fix wrong check for plan versions (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
diego-escobedo authored Dec 18, 2023
1 parent 95e8ae0 commit 0d7337a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions backend/metering_billing/serializers/serializer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ def to_representation(self, obj):
return BalanceAdjustmentUUIDField().to_representation(obj.adjustment_id)
elif isinstance(obj, Metric):
return MetricUUIDField().to_representation(obj.metric_id)
elif isinstance(obj, Plan) and obj.addon_spec is None:
elif isinstance(obj, Plan) and obj.is_addon is False:
return PlanUUIDField().to_representation(obj.plan_id)
elif isinstance(obj, Plan) and obj.addon_spec is not None:
elif isinstance(obj, Plan) and obj.is_addon is True:
return AddOnUUIDField().to_representation(obj.plan_id)
elif isinstance(obj, PlanVersion):
return PlanVersionUUIDField().to_representation(obj.version_id)
Expand All @@ -176,13 +176,13 @@ def to_representation(self, obj):
elif isinstance(obj, Invoice):
return InvoiceUUIDField().to_representation(obj.invoice_id)
elif isinstance(obj, SubscriptionRecord):
if obj.plan_version.addon_spec is None:
if obj.billing_plan.addon_spec is None:
return SubscriptionUUIDField().to_representation(
obj.susbcription_record_id
obj.subscription_record_id
)
else:
return AddOnSubscriptionUUIDField().to_representation(
obj.susbcription_record_id
obj.subscription_record_id
)
return repr

Expand Down

0 comments on commit 0d7337a

Please sign in to comment.