Skip to content

Commit

Permalink
Merge pull request #12217 from dimagi/np/skip_invoice
Browse files Browse the repository at this point in the history
add flag to skip invoicing if there are no feature charges
  • Loading branch information
proteusvacuum committed Jun 24, 2016
2 parents ee8cea7 + 7c8f246 commit c7d1598
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions corehq/apps/accounting/invoicing.py
Expand Up @@ -137,6 +137,16 @@ def _get_invoice_end(sub, date_end):
)
return

if (
subscription.skip_invoicing_if_no_feature_charges
and not subscription.plan_version.feature_charges_exist_for_domain(self.domain)
):
log_accounting_info(
"Skipping invoicing for Subscription %s because there are no feature charges."
% subscription.pk
)
return

invoice_start = _get_invoice_start(subscription, self.date_start)
invoice_end = _get_invoice_end(subscription, self.date_end)

Expand Down
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('accounting', '0035_kill_date_received'),
]

operations = [
migrations.AddField(
model_name='subscription',
name='skip_invoicing_if_no_feature_charges',
field=models.BooleanField(default=False),
preserve_default=True,
),
]
1 change: 1 addition & 0 deletions corehq/apps/accounting/models.py
Expand Up @@ -1006,6 +1006,7 @@ class Subscription(models.Model):
do_not_email_reminder = models.BooleanField(default=False)
auto_generate_credits = models.BooleanField(default=False)
is_trial = models.BooleanField(default=False)
skip_invoicing_if_no_feature_charges = models.BooleanField(default=False)
service_type = models.CharField(
max_length=25,
choices=SubscriptionType.CHOICES,
Expand Down

0 comments on commit c7d1598

Please sign in to comment.