{"action":"created","comment":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/200786633","pull_request_review_id":135175764,"id":200786633,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDc4NjYzMw==","diff_hunk":"@@ -0,0 +1,70 @@\n+# -*- coding: utf-8 -*-\n+# Generated by Django 1.11.14 on 2018-07-06 17:45\n+from __future__ import unicode_literals\n+\n+from decimal import Decimal\n+import django.contrib.postgres.fields\n+from django.db import migrations, models\n+import django.db.models.deletion\n+\n+\n+class Migration(migrations.Migration):\n+\n+    replaces = [('accounting', '0032_customerinvoice'), ('accounting', '0033_auto_20180628_2136'), ('accounting', '0034_auto_20180629_1914'), ('accounting', '0035_customerinvoice_subscriptions'), ('accounting', '0036_customerbillingrecord')]\n+\n+    dependencies = [\n+        ('accounting', '0031_billingaccount_billing_admin_emails'),\n+    ]\n+\n+    operations = [\n+        migrations.CreateModel(\n+            name='CustomerInvoice',\n+            fields=[\n+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n+                ('date_created', models.DateTimeField(auto_now_add=True)),\n+                ('is_hidden', models.BooleanField(default=False)),\n+                ('tax_rate', models.DecimalField(decimal_places=4, default=Decimal('0.0000'), max_digits=10)),\n+                ('balance', models.DecimalField(decimal_places=4, default=Decimal('0.0000'), max_digits=10)),\n+                ('date_due', models.DateField(db_index=True, null=True)),\n+                ('date_paid', models.DateField(blank=True, null=True)),\n+                ('date_start', models.DateField()),\n+                ('date_end', models.DateField()),\n+                ('is_hidden_to_ops', models.BooleanField(default=False)),\n+                ('last_modified', models.DateTimeField(auto_now=True)),\n+                ('account', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='accounting.BillingAccount')),\n+                ('subscriptions', models.ManyToManyField(blank=True, default=list, to=b'accounting.Subscription')),\n+            ],\n+        ),\n+        migrations.RenameField(\n+            model_name='lineitem',\n+            old_name='invoice',\n+            new_name='subscription_invoice',\n+        ),\n+        migrations.AddField(\n+            model_name='creditadjustment',\n+            name='customer_invoice',\n+            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='accounting.CustomerInvoice'),\n+        ),\n+        migrations.AddField(\n+            model_name='lineitem',\n+            name='customer_invoice',\n+            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='accounting.CustomerInvoice'),","path":"corehq/apps/accounting/migrations/0032_customerinvoice_squashed_0036_customerbillingrecord.py","position":51,"original_position":51,"commit_id":"90915af99e05c227d20e25db7f901b4b38a0db38","original_commit_id":"90915af99e05c227d20e25db7f901b4b38a0db38","user":{"login":"stickler-ci","id":16011037,"node_id":"MDQ6VXNlcjE2MDExMDM3","avatar_url":"https://avatars3.githubusercontent.com/u/16011037?v=4","gravatar_id":"","url":"https://api.github.com/users/stickler-ci","html_url":"https://github.com/stickler-ci","followers_url":"https://api.github.com/users/stickler-ci/followers","following_url":"https://api.github.com/users/stickler-ci/following{/other_user}","gists_url":"https://api.github.com/users/stickler-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/stickler-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stickler-ci/subscriptions","organizations_url":"https://api.github.com/users/stickler-ci/orgs","repos_url":"https://api.github.com/users/stickler-ci/repos","events_url":"https://api.github.com/users/stickler-ci/events{/privacy}","received_events_url":"https://api.github.com/users/stickler-ci/received_events","type":"User","site_admin":false},"body":"E501 line too long (125 > 115 characters)","created_at":"2018-07-06T22:43:05Z","updated_at":"2018-07-06T22:43:07Z","html_url":"https://github.com/dimagi/commcare-hq/pull/21135#discussion_r200786633","pull_request_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/21135","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/200786633"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/21135#discussion_r200786633"},"pull_request":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/21135"}}},"pull_request":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/21135","id":199788920,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5Nzg4OTIw","html_url":"https://github.com/dimagi/commcare-hq/pull/21135","diff_url":"https://github.com/dimagi/commcare-hq/pull/21135.diff","patch_url":"https://github.com/dimagi/commcare-hq/pull/21135.patch","issue_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/21135","number":21135,"state":"open","locked":false,"title":"Customer account invoicing","user":{"login":"gbova","id":15271571,"node_id":"MDQ6VXNlcjE1MjcxNTcx","avatar_url":"https://avatars0.githubusercontent.com/u/15271571?v=4","gravatar_id":"","url":"https://api.github.com/users/gbova","html_url":"https://github.com/gbova","followers_url":"https://api.github.com/users/gbova/followers","following_url":"https://api.github.com/users/gbova/following{/other_user}","gists_url":"https://api.github.com/users/gbova/gists{/gist_id}","starred_url":"https://api.github.com/users/gbova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gbova/subscriptions","organizations_url":"https://api.github.com/users/gbova/orgs","repos_url":"https://api.github.com/users/gbova/repos","events_url":"https://api.github.com/users/gbova/events{/privacy}","received_events_url":"https://api.github.com/users/gbova/received_events","type":"User","site_admin":false},"body":"@nickpell  This PR is pretty big now. I added:\r\n\r\n`CustomerInvoice` now includes the customer account and the list of subscriptions that are relevant to the invoice. Including those subscriptions ended up being necessary to apply credits, an they may be good to have if we want a way to remind billing admins of their plans/domains in the future.\r\n\r\n`CustomerBillingRecord` to handle emailing the invoice and applying credits.\r\n\r\n`CustomerInvoiceSummaryView` and `InvoicePdfView` as URLs to view a customer invoice and its PDF, respectively.\r\n\r\n`CustomerInvoiceInterface` is to view/search for customer invoices, similar to Invoice and WireInvoice interfaces.\r\n\r\nThe invoicing process for customer-level accounts creates a CustomerInvoice and a CustomerBillingRecord now, so only one invoice will be created. There is a Customer Invoices tab under \"Accounting Admin\" to view/search for all customer invoices.\r\n\r\n(I still need to write more tests for this.)","created_at":"2018-07-06T16:07:32Z","updated_at":"2018-07-06T22:43:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee062eb530d5d835594231e8502c3e3bd1e8f506","assignee":null,"assignees":[],"requested_reviewers":[{"login":"gcapalbo","id":1028814,"node_id":"MDQ6VXNlcjEwMjg4MTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1028814?v=4","gravatar_id":"","url":"https://api.github.com/users/gcapalbo","html_url":"https://github.com/gcapalbo","followers_url":"https://api.github.com/users/gcapalbo/followers","following_url":"https://api.github.com/users/gcapalbo/following{/other_user}","gists_url":"https://api.github.com/users/gcapalbo/gists{/gist_id}","starred_url":"https://api.github.com/users/gcapalbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcapalbo/subscriptions","organizations_url":"https://api.github.com/users/gcapalbo/orgs","repos_url":"https://api.github.com/users/gcapalbo/repos","events_url":"https://api.github.com/users/gcapalbo/events{/privacy}","received_events_url":"https://api.github.com/users/gcapalbo/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":911546454,"node_id":"MDU6TGFiZWw5MTE1NDY0NTQ=","url":"https://api.github.com/repos/dimagi/commcare-hq/labels/product/admin","name":"product/admin","color":"75ff68","default":false},{"id":724784918,"node_id":"MDU6TGFiZWw3MjQ3ODQ5MTg=","url":"https://api.github.com/repos/dimagi/commcare-hq/labels/product/all-users-all-environments","name":"product/all-users-all-environments","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/21135/commits","review_comments_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/21135/comments","review_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/21135/comments","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/90915af99e05c227d20e25db7f901b4b38a0db38","head":{"label":"dimagi:customer-account-invoicing","ref":"customer-account-invoicing","sha":"90915af99e05c227d20e25db7f901b4b38a0db38","user":{"login":"dimagi","id":94514,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk0NTE0","avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":247278,"node_id":"MDEwOlJlcG9zaXRvcnkyNDcyNzg=","name":"commcare-hq","full_name":"dimagi/commcare-hq","owner":{"login":"dimagi","id":94514,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk0NTE0","avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-hq","forks_url":"https://api.github.com/repos/dimagi/commcare-hq/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-hq/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-hq/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-hq/releases{/id}","deployments_url":"https://api.github.com/repos/dimagi/commcare-hq/deployments","created_at":"2009-07-09T17:00:07Z","updated_at":"2018-07-06T22:18:04Z","pushed_at":"2018-07-06T22:41:35Z","git_url":"git://github.com/dimagi/commcare-hq.git","ssh_url":"git@github.com:dimagi/commcare-hq.git","clone_url":"https://github.com/dimagi/commcare-hq.git","svn_url":"https://github.com/dimagi/commcare-hq","homepage":"https://www.commcarehq.org","size":446377,"stargazers_count":93,"watchers_count":93,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":106,"mirror_url":null,"archived":false,"open_issues_count":81,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":106,"open_issues":81,"watchers":93,"default_branch":"master"}},"base":{"label":"dimagi:master","ref":"master","sha":"a27f060b390108271bff0c9897f1ed32e51419ac","user":{"login":"dimagi","id":94514,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk0NTE0","avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":247278,"node_id":"MDEwOlJlcG9zaXRvcnkyNDcyNzg=","name":"commcare-hq","full_name":"dimagi/commcare-hq","owner":{"login":"dimagi","id":94514,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk0NTE0","avatar_url":"https://avatars1.githubusercontent.com/u/94514?v=4","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-hq","forks_url":"https://api.github.com/repos/dimagi/commcare-hq/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-hq/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-hq/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-hq/releases{/id}","deployments_url":"https://api.github.com/repos/dimagi/commcare-hq/deployments","created_at":"2009-07-09T17:00:07Z","updated_at":"2018-07-06T22:18:04Z","pushed_at":"2018-07-06T22:41:35Z","git_url":"git://github.com/dimagi/commcare-hq.git","ssh_url":"git@github.com:dimagi/commcare-hq.git","clone_url":"https://github.com/dimagi/commcare-hq.git","svn_url":"https://github.com/dimagi/commcare-hq","homepage":"https://www.commcarehq.org","size":446377,"stargazers_count":93,"watchers_count":93,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":106,"mirror_url":null,"archived":false,"open_issues_count":81,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":106,"open_issues":81,"watchers":93,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/21135"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/21135"},"issue":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/21135"},"comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/21135/comments"},"review_comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/21135/comments"},"review_comment":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/21135/commits"},"statuses":{"href":"https://api.github.com/repos/dimagi/commcare-hq/statuses/90915af99e05c227d20e25db7f901b4b38a0db38"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"stickler-ci"}}