GitHub PullRequestReviewCommentEvent at 2014-12-02 08:20:24
Repository: compassion-modules
Actor: ecino
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/comments/21144885","id":21144885,"diff_hunk":"@@ -32,44 +36,98 @@ def _get_contract_from_invoice(invoice_obj, cr, uid, invoice_ids,\n                                    context=None):\r\n         self = invoice_obj.pool.get('recurring.contract')\r\n         res = []\r\n+        # Read data in english\r\n+        if context is None:\r\n+            context = {}\r\n+        context['lang'] = 'en_US'\r\n         for invoice in invoice_obj.browse(cr, uid, invoice_ids,\r\n                                           context=context):\r\n             if invoice.state == 'paid':\r\n-                self._invoice_paid(cr, uid, invoice, context=context)\r\n+                self._invoice_paid(cr, uid, invoice, context)\r\n                 last_pay_date = max([move_line.date\r\n                                      for move_line in invoice.payment_ids\r\n-                                     if move_line.credit > 0] or [0])\r\n+                                     if move_line.credit > 0] or [0])\n                 for invoice_line in invoice.invoice_line:\r\n                     contract = invoice_line.contract_id\r\n                     if contract.state == 'waiting' and last_pay_date:\r\n-                        # We should activate the contract and set the\r\n-                        # first_payment_date\r\n+                        # Activate the contract and set the\r\n+                        # activation_date\r\n                         res.append(invoice_line.contract_id.id)\r\n-                        self.write(cr, uid, contract.id,\r\n-                                   {'first_payment_date': last_pay_date},\r\n-                                   context=context)\r\n+                        self.write(\r\n+                            cr, uid, contract.id, {\r\n+                                'activation_date':\r\n+                                    datetime.today().strftime(DF)},\r\n+                            context=context)\r\n \r\n         return res\r\n \r\n     def _on_contract_active(self, cr, uid, ids, context=None):\r\n-        \"\"\" Hook for doing something when contract is activated. \"\"\"\r\n-        wf_service = netsvc.LocalService('workflow')\r\n-        for id in ids:\r\n-            logger.info(\"Contract \" + str(id) + \" activated.\")\r\n-            wf_service.trg_validate(uid, 'recurring.contract', id,\r\n-                                    'contract_active', cr)\r\n+        \"\"\" Hook for doing something when contract is activated.\r\n+        Update child to mark it has been sponsored, and update partner\r\n+        to add the 'Sponsor' category.\r\n+        \"\"\"\r\n+        wf_service = netsvc.LocalService('workflow')\n+        if not isinstance(ids, list):\r\n+            ids = [ids]\r\n+        sponsor_cat_id = self.pool.get('res.partner.category').search(\r\n+            cr, uid, [('name', '=', 'Sponsor')], context={'lang': 'en_US'})[0]\r\n+        for contract in self.browse(cr, uid, ids, context):\r\n+            if contract.child_id:\r\n+                contract.child_id.write({'has_been_sponsored': True})\r\n+                partner_categories = set(\r\n+                    [cat.id for cat in contract.partner_id.category_id])\r\n+                partner_categories.add(sponsor_cat_id)\r","path":"sponsorship_compassion/model/contracts.py","position":75,"original_position":75,"commit_id":"af85b4e601a5417f38025d8f62dcd521055112e9","original_commit_id":"af85b4e601a5417f38025d8f62dcd521055112e9","user":{"login":"ecino","id":8435180,"avatar_url":"https://avatars.githubusercontent.com/u/8435180?v=3","gravatar_id":"","url":"https://api.github.com/users/ecino","html_url":"https://github.com/ecino","followers_url":"https://api.github.com/users/ecino/followers","following_url":"https://api.github.com/users/ecino/following{/other_user}","gists_url":"https://api.github.com/users/ecino/gists{/gist_id}","starred_url":"https://api.github.com/users/ecino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecino/subscriptions","organizations_url":"https://api.github.com/users/ecino/orgs","repos_url":"https://api.github.com/users/ecino/repos","events_url":"https://api.github.com/users/ecino/events{/privacy}","received_events_url":"https://api.github.com/users/ecino/received_events","type":"User","site_admin":false},"body":"Thank you!","created_at":"2014-12-02T08:20:24Z","updated_at":"2014-12-02T08:20:24Z","html_url":"https://github.com/CompassionCH/compassion-modules/pull/24#discussion_r21144885","pull_request_url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/24","_links":{"self":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/comments/21144885"},"html":{"href":"https://github.com/CompassionCH/compassion-modules/pull/24#discussion_r21144885"},"pull_request":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/24"}}},"pull_request":{"url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/24","id":25265097,"html_url":"https://github.com/CompassionCH/compassion-modules/pull/24","diff_url":"https://github.com/CompassionCH/compassion-modules/pull/24.diff","patch_url":"https://github.com/CompassionCH/compassion-modules/pull/24.patch","issue_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/24","number":24,"state":"open","locked":false,"title":"Sync contracts gp","user":{"login":"ecino","id":8435180,"avatar_url":"https://avatars.githubusercontent.com/u/8435180?v=3","gravatar_id":"","url":"https://api.github.com/users/ecino","html_url":"https://github.com/ecino","followers_url":"https://api.github.com/users/ecino/followers","following_url":"https://api.github.com/users/ecino/following{/other_user}","gists_url":"https://api.github.com/users/ecino/gists{/gist_id}","starred_url":"https://api.github.com/users/ecino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecino/subscriptions","organizations_url":"https://api.github.com/users/ecino/orgs","repos_url":"https://api.github.com/users/ecino/repos","events_url":"https://api.github.com/users/ecino/events{/privacy}","received_events_url":"https://api.github.com/users/ecino/received_events","type":"User","site_admin":false},"body":"Again a huge PR. We will do some functional testing during this week. This code should be used for next stable version (will be merged in branch 7.0), and will be used as soon as we are ready. Changes include:\r\n\r\n- New Child State Workflow\r\n- Child exit reasons (prepared for webservice retrieval, but the webservice is still in beta mode)\r\n- Module sponsorship_sync, to synchronize with GP.\r\n- Remove sponsored children from the website automatically\r\n- Menus reorganization\r\n- LSV,DD Communication improved\r\n- Improves different search view to add filters and search options\r\n- Contract origins\r\n- End sponsorship wizard to include reasons of ending and updating child status.\r\n- CRM_compassion, for managing events and projects.\r\n\r\nWith this release, users will create/edit and end sponsorships from Odoo. Accounting will be made in Odoo, as well as events planning. Everything else is still available in GP, and the two programs will work together.\r\n\r\nPS: I took care not to include translations in the PR, they will come in a separate PR.\r\n","created_at":"2014-12-01T12:33:50Z","updated_at":"2014-12-02T08:20:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"35aa951368e9ebcbba5f35ad7e13bae5a7627b31","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/24/commits","review_comments_url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/24/comments","review_comment_url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/comments/{number}","comments_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/24/comments","statuses_url":"https://api.github.com/repos/CompassionCH/compassion-modules/statuses/af85b4e601a5417f38025d8f62dcd521055112e9","head":{"label":"CompassionCH:sync-contracts-gp","ref":"sync-contracts-gp","sha":"af85b4e601a5417f38025d8f62dcd521055112e9","user":{"login":"CompassionCH","id":8435213,"avatar_url":"https://avatars.githubusercontent.com/u/8435213?v=3","gravatar_id":"","url":"https://api.github.com/users/CompassionCH","html_url":"https://github.com/CompassionCH","followers_url":"https://api.github.com/users/CompassionCH/followers","following_url":"https://api.github.com/users/CompassionCH/following{/other_user}","gists_url":"https://api.github.com/users/CompassionCH/gists{/gist_id}","starred_url":"https://api.github.com/users/CompassionCH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CompassionCH/subscriptions","organizations_url":"https://api.github.com/users/CompassionCH/orgs","repos_url":"https://api.github.com/users/CompassionCH/repos","events_url":"https://api.github.com/users/CompassionCH/events{/privacy}","received_events_url":"https://api.github.com/users/CompassionCH/received_events","type":"Organization","site_admin":false},"repo":{"id":23073482,"name":"compassion-modules","full_name":"CompassionCH/compassion-modules","owner":{"login":"CompassionCH","id":8435213,"avatar_url":"https://avatars.githubusercontent.com/u/8435213?v=3","gravatar_id":"","url":"https://api.github.com/users/CompassionCH","html_url":"https://github.com/CompassionCH","followers_url":"https://api.github.com/users/CompassionCH/followers","following_url":"https://api.github.com/users/CompassionCH/following{/other_user}","gists_url":"https://api.github.com/users/CompassionCH/gists{/gist_id}","starred_url":"https://api.github.com/users/CompassionCH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CompassionCH/subscriptions","organizations_url":"https://api.github.com/users/CompassionCH/orgs","repos_url":"https://api.github.com/users/CompassionCH/repos","events_url":"https://api.github.com/users/CompassionCH/events{/privacy}","received_events_url":"https://api.github.com/users/CompassionCH/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CompassionCH/compassion-modules","description":"","fork":false,"url":"https://api.github.com/repos/CompassionCH/compassion-modules","forks_url":"https://api.github.com/repos/CompassionCH/compassion-modules/forks","keys_url":"https://api.github.com/repos/CompassionCH/compassion-modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CompassionCH/compassion-modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CompassionCH/compassion-modules/teams","hooks_url":"https://api.github.com/repos/CompassionCH/compassion-modules/hooks","issue_events_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/events{/number}","events_url":"https://api.github.com/repos/CompassionCH/compassion-modules/events","assignees_url":"https://api.github.com/repos/CompassionCH/compassion-modules/assignees{/user}","branches_url":"https://api.github.com/repos/CompassionCH/compassion-modules/branches{/branch}","tags_url":"https://api.github.com/repos/CompassionCH/compassion-modules/tags","blobs_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CompassionCH/compassion-modules/statuses/{sha}","languages_url":"https://api.github.com/repos/CompassionCH/compassion-modules/languages","stargazers_url":"https://api.github.com/repos/CompassionCH/compassion-modules/stargazers","contributors_url":"https://api.github.com/repos/CompassionCH/compassion-modules/contributors","subscribers_url":"https://api.github.com/repos/CompassionCH/compassion-modules/subscribers","subscription_url":"https://api.github.com/repos/CompassionCH/compassion-modules/subscription","commits_url":"https://api.github.com/repos/CompassionCH/compassion-modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/CompassionCH/compassion-modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/comments/{number}","contents_url":"https://api.github.com/repos/CompassionCH/compassion-modules/contents/{+path}","compare_url":"https://api.github.com/repos/CompassionCH/compassion-modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CompassionCH/compassion-modules/merges","archive_url":"https://api.github.com/repos/CompassionCH/compassion-modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CompassionCH/compassion-modules/downloads","issues_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues{/number}","pulls_url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls{/number}","milestones_url":"https://api.github.com/repos/CompassionCH/compassion-modules/milestones{/number}","notifications_url":"https://api.github.com/repos/CompassionCH/compassion-modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CompassionCH/compassion-modules/labels{/name}","releases_url":"https://api.github.com/repos/CompassionCH/compassion-modules/releases{/id}","created_at":"2014-08-18T14:08:09Z","updated_at":"2014-11-28T15:21:50Z","pushed_at":"2014-12-01T12:21:15Z","git_url":"git://github.com/CompassionCH/compassion-modules.git","ssh_url":"git@github.com:CompassionCH/compassion-modules.git","clone_url":"https://github.com/CompassionCH/compassion-modules.git","svn_url":"https://github.com/CompassionCH/compassion-modules","homepage":null,"size":2141,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"CompassionCH:master","ref":"master","sha":"4011c2a74bbebe0d8d2c31ad4751cffccf6ec35a","user":{"login":"CompassionCH","id":8435213,"avatar_url":"https://avatars.githubusercontent.com/u/8435213?v=3","gravatar_id":"","url":"https://api.github.com/users/CompassionCH","html_url":"https://github.com/CompassionCH","followers_url":"https://api.github.com/users/CompassionCH/followers","following_url":"https://api.github.com/users/CompassionCH/following{/other_user}","gists_url":"https://api.github.com/users/CompassionCH/gists{/gist_id}","starred_url":"https://api.github.com/users/CompassionCH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CompassionCH/subscriptions","organizations_url":"https://api.github.com/users/CompassionCH/orgs","repos_url":"https://api.github.com/users/CompassionCH/repos","events_url":"https://api.github.com/users/CompassionCH/events{/privacy}","received_events_url":"https://api.github.com/users/CompassionCH/received_events","type":"Organization","site_admin":false},"repo":{"id":23073482,"name":"compassion-modules","full_name":"CompassionCH/compassion-modules","owner":{"login":"CompassionCH","id":8435213,"avatar_url":"https://avatars.githubusercontent.com/u/8435213?v=3","gravatar_id":"","url":"https://api.github.com/users/CompassionCH","html_url":"https://github.com/CompassionCH","followers_url":"https://api.github.com/users/CompassionCH/followers","following_url":"https://api.github.com/users/CompassionCH/following{/other_user}","gists_url":"https://api.github.com/users/CompassionCH/gists{/gist_id}","starred_url":"https://api.github.com/users/CompassionCH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CompassionCH/subscriptions","organizations_url":"https://api.github.com/users/CompassionCH/orgs","repos_url":"https://api.github.com/users/CompassionCH/repos","events_url":"https://api.github.com/users/CompassionCH/events{/privacy}","received_events_url":"https://api.github.com/users/CompassionCH/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CompassionCH/compassion-modules","description":"","fork":false,"url":"https://api.github.com/repos/CompassionCH/compassion-modules","forks_url":"https://api.github.com/repos/CompassionCH/compassion-modules/forks","keys_url":"https://api.github.com/repos/CompassionCH/compassion-modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CompassionCH/compassion-modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CompassionCH/compassion-modules/teams","hooks_url":"https://api.github.com/repos/CompassionCH/compassion-modules/hooks","issue_events_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/events{/number}","events_url":"https://api.github.com/repos/CompassionCH/compassion-modules/events","assignees_url":"https://api.github.com/repos/CompassionCH/compassion-modules/assignees{/user}","branches_url":"https://api.github.com/repos/CompassionCH/compassion-modules/branches{/branch}","tags_url":"https://api.github.com/repos/CompassionCH/compassion-modules/tags","blobs_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CompassionCH/compassion-modules/statuses/{sha}","languages_url":"https://api.github.com/repos/CompassionCH/compassion-modules/languages","stargazers_url":"https://api.github.com/repos/CompassionCH/compassion-modules/stargazers","contributors_url":"https://api.github.com/repos/CompassionCH/compassion-modules/contributors","subscribers_url":"https://api.github.com/repos/CompassionCH/compassion-modules/subscribers","subscription_url":"https://api.github.com/repos/CompassionCH/compassion-modules/subscription","commits_url":"https://api.github.com/repos/CompassionCH/compassion-modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/CompassionCH/compassion-modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/CompassionCH/compassion-modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/comments/{number}","contents_url":"https://api.github.com/repos/CompassionCH/compassion-modules/contents/{+path}","compare_url":"https://api.github.com/repos/CompassionCH/compassion-modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CompassionCH/compassion-modules/merges","archive_url":"https://api.github.com/repos/CompassionCH/compassion-modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CompassionCH/compassion-modules/downloads","issues_url":"https://api.github.com/repos/CompassionCH/compassion-modules/issues{/number}","pulls_url":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls{/number}","milestones_url":"https://api.github.com/repos/CompassionCH/compassion-modules/milestones{/number}","notifications_url":"https://api.github.com/repos/CompassionCH/compassion-modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CompassionCH/compassion-modules/labels{/name}","releases_url":"https://api.github.com/repos/CompassionCH/compassion-modules/releases{/id}","created_at":"2014-08-18T14:08:09Z","updated_at":"2014-11-28T15:21:50Z","pushed_at":"2014-12-01T12:21:15Z","git_url":"git://github.com/CompassionCH/compassion-modules.git","ssh_url":"git@github.com:CompassionCH/compassion-modules.git","clone_url":"https://github.com/CompassionCH/compassion-modules.git","svn_url":"https://github.com/CompassionCH/compassion-modules","homepage":null,"size":2141,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/24"},"html":{"href":"https://github.com/CompassionCH/compassion-modules/pull/24"},"issue":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/24"},"comments":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/issues/24/comments"},"review_comments":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/24/comments"},"review_comment":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/pulls/24/commits"},"statuses":{"href":"https://api.github.com/repos/CompassionCH/compassion-modules/statuses/af85b4e601a5417f38025d8f62dcd521055112e9"}}}}