{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/operating-unit/pulls/comments/170190476","pull_request_review_id":98838669,"id":170190476,"diff_hunk":"@@ -0,0 +1,82 @@\n+# Copyright 2018 Camptocamp SA\n+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n+from odoo.tests.common import SavepointCase\n+\n+\n+class TestOperatiingUnitUserId(SavepointCase):\n+\n+    def setUp(self):\n+        super().setUp()\n+\n+        self.ou1 = self.env.ref('operating_unit.b2c_operating_unit')\n+        self.ou2 = self.env.ref('operating_unit.b2b_operating_unit')\n+\n+        self.user1 = self.env['res.users'].create({\n+            'name': 'User 1',\n+            'login': 'user1',\n+            'operating_unit_ids': [(4, self.ou1.id)]\n+        })\n+\n+        self.user2 = self.env['res.users'].create({\n+            'name': 'User 2',\n+            'login': 'user2',\n+            'operating_unit_ids': [(4, self.ou2.id)]\n+        })\n+\n+        self.user3 = self.env['res.users'].create({\n+            'name': 'User 3',\n+            'login': 'user3',\n+            'operating_unit_ids': [(4, self.ou1.id), (4, self.ou2.id)]\n+        })\n+\n+        self.event1 = self.env['event.event'].create({\n+            'name': 'Testevent',\n+            'operating_unit_id': self.ou1.id,\n+            'date_begin': '2018-03-01 10:00:00',\n+            'date_end': '2018-03-01 11:00:00'\n+        })\n+\n+        self.event2 = self.env['event.event'].create({\n+            'name': 'Testevent',\n+            'operating_unit_id': self.ou2.id,\n+            'date_begin': '2018-03-01 10:00:00',\n+            'date_end': '2018-03-01 11:00:00'\n+        })\n+\n+    def test_compute(self):\n+        res = self.event1.operating_unit_user_ids\n+        self.assertEqual(len(res), 3)\n+        logins = [item.login for item in res]\n+        self.assertIn(self.user1.login, logins)\n+        self.assertIn(self.user3.login, logins)\n+        self.assertNotIn(self.user2.login, logins)\n+\n+        res = self.event2.operating_unit_user_ids\n+        self.assertEqual(len(res), 3)\n+        logins = [item.login for item in res]","path":"event_operating_unit/tests/test_operating_unit_user_id.py","position":56,"original_position":56,"commit_id":"3355ab2e2e9822298e1189f3c270a6b6cada6133","original_commit_id":"3355ab2e2e9822298e1189f3c270a6b6cada6133","user":{"login":"grindtildeath","id":778828,"avatar_url":"https://avatars3.githubusercontent.com/u/778828?v=4","gravatar_id":"","url":"https://api.github.com/users/grindtildeath","html_url":"https://github.com/grindtildeath","followers_url":"https://api.github.com/users/grindtildeath/followers","following_url":"https://api.github.com/users/grindtildeath/following{/other_user}","gists_url":"https://api.github.com/users/grindtildeath/gists{/gist_id}","starred_url":"https://api.github.com/users/grindtildeath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grindtildeath/subscriptions","organizations_url":"https://api.github.com/users/grindtildeath/orgs","repos_url":"https://api.github.com/users/grindtildeath/repos","events_url":"https://api.github.com/users/grindtildeath/events{/privacy}","received_events_url":"https://api.github.com/users/grindtildeath/received_events","type":"User","site_admin":false},"body":"same here","created_at":"2018-02-23T08:24:59Z","updated_at":"2018-02-23T08:38:13Z","html_url":"https://github.com/OCA/operating-unit/pull/110#discussion_r170190476","pull_request_url":"https://api.github.com/repos/OCA/operating-unit/pulls/110","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/OCA/operating-unit/pulls/comments/170190476"},"html":{"href":"https://github.com/OCA/operating-unit/pull/110#discussion_r170190476"},"pull_request":{"href":"https://api.github.com/repos/OCA/operating-unit/pulls/110"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/operating-unit/pulls/110","id":170809596,"html_url":"https://github.com/OCA/operating-unit/pull/110","diff_url":"https://github.com/OCA/operating-unit/pull/110.diff","patch_url":"https://github.com/OCA/operating-unit/pull/110.patch","issue_url":"https://api.github.com/repos/OCA/operating-unit/issues/110","number":110,"state":"open","locked":false,"title":"[11.0][IMP] Add Event Operating Unit module","user":{"login":"tschanzt","id":358342,"avatar_url":"https://avatars1.githubusercontent.com/u/358342?v=4","gravatar_id":"","url":"https://api.github.com/users/tschanzt","html_url":"https://github.com/tschanzt","followers_url":"https://api.github.com/users/tschanzt/followers","following_url":"https://api.github.com/users/tschanzt/following{/other_user}","gists_url":"https://api.github.com/users/tschanzt/gists{/gist_id}","starred_url":"https://api.github.com/users/tschanzt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschanzt/subscriptions","organizations_url":"https://api.github.com/users/tschanzt/orgs","repos_url":"https://api.github.com/users/tschanzt/repos","events_url":"https://api.github.com/users/tschanzt/events{/privacy}","received_events_url":"https://api.github.com/users/tschanzt/received_events","type":"User","site_admin":false},"body":"This PR adds operating units to events.\r\nMain points:\r\n    - Adds a operating_unit_id field to the event.\r\n    - Adds a related field to the event operating_unit_id on event.registration, event.track and event.sponsor.\r\n    - Adds a filter to only show elements from the users current operating units.\r\n","created_at":"2018-02-22T17:04:24Z","updated_at":"2018-02-23T08:38:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e718383d3076cfb6e55121321a02b9d4aef505e1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/OCA/operating-unit/pulls/110/commits","review_comments_url":"https://api.github.com/repos/OCA/operating-unit/pulls/110/comments","review_comment_url":"https://api.github.com/repos/OCA/operating-unit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/operating-unit/issues/110/comments","statuses_url":"https://api.github.com/repos/OCA/operating-unit/statuses/3355ab2e2e9822298e1189f3c270a6b6cada6133","head":{"label":"tschanzt:tt-events","ref":"tt-events","sha":"3355ab2e2e9822298e1189f3c270a6b6cada6133","user":{"login":"tschanzt","id":358342,"avatar_url":"https://avatars1.githubusercontent.com/u/358342?v=4","gravatar_id":"","url":"https://api.github.com/users/tschanzt","html_url":"https://github.com/tschanzt","followers_url":"https://api.github.com/users/tschanzt/followers","following_url":"https://api.github.com/users/tschanzt/following{/other_user}","gists_url":"https://api.github.com/users/tschanzt/gists{/gist_id}","starred_url":"https://api.github.com/users/tschanzt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschanzt/subscriptions","organizations_url":"https://api.github.com/users/tschanzt/orgs","repos_url":"https://api.github.com/users/tschanzt/repos","events_url":"https://api.github.com/users/tschanzt/events{/privacy}","received_events_url":"https://api.github.com/users/tschanzt/received_events","type":"User","site_admin":false},"repo":{"id":122506849,"name":"operating-unit","full_name":"tschanzt/operating-unit","owner":{"login":"tschanzt","id":358342,"avatar_url":"https://avatars1.githubusercontent.com/u/358342?v=4","gravatar_id":"","url":"https://api.github.com/users/tschanzt","html_url":"https://github.com/tschanzt","followers_url":"https://api.github.com/users/tschanzt/followers","following_url":"https://api.github.com/users/tschanzt/following{/other_user}","gists_url":"https://api.github.com/users/tschanzt/gists{/gist_id}","starred_url":"https://api.github.com/users/tschanzt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschanzt/subscriptions","organizations_url":"https://api.github.com/users/tschanzt/orgs","repos_url":"https://api.github.com/users/tschanzt/repos","events_url":"https://api.github.com/users/tschanzt/events{/privacy}","received_events_url":"https://api.github.com/users/tschanzt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tschanzt/operating-unit","description":"Manage Operating Units in Odoo","fork":true,"url":"https://api.github.com/repos/tschanzt/operating-unit","forks_url":"https://api.github.com/repos/tschanzt/operating-unit/forks","keys_url":"https://api.github.com/repos/tschanzt/operating-unit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tschanzt/operating-unit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tschanzt/operating-unit/teams","hooks_url":"https://api.github.com/repos/tschanzt/operating-unit/hooks","issue_events_url":"https://api.github.com/repos/tschanzt/operating-unit/issues/events{/number}","events_url":"https://api.github.com/repos/tschanzt/operating-unit/events","assignees_url":"https://api.github.com/repos/tschanzt/operating-unit/assignees{/user}","branches_url":"https://api.github.com/repos/tschanzt/operating-unit/branches{/branch}","tags_url":"https://api.github.com/repos/tschanzt/operating-unit/tags","blobs_url":"https://api.github.com/repos/tschanzt/operating-unit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tschanzt/operating-unit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tschanzt/operating-unit/git/refs{/sha}","trees_url":"https://api.github.com/repos/tschanzt/operating-unit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tschanzt/operating-unit/statuses/{sha}","languages_url":"https://api.github.com/repos/tschanzt/operating-unit/languages","stargazers_url":"https://api.github.com/repos/tschanzt/operating-unit/stargazers","contributors_url":"https://api.github.com/repos/tschanzt/operating-unit/contributors","subscribers_url":"https://api.github.com/repos/tschanzt/operating-unit/subscribers","subscription_url":"https://api.github.com/repos/tschanzt/operating-unit/subscription","commits_url":"https://api.github.com/repos/tschanzt/operating-unit/commits{/sha}","git_commits_url":"https://api.github.com/repos/tschanzt/operating-unit/git/commits{/sha}","comments_url":"https://api.github.com/repos/tschanzt/operating-unit/comments{/number}","issue_comment_url":"https://api.github.com/repos/tschanzt/operating-unit/issues/comments{/number}","contents_url":"https://api.github.com/repos/tschanzt/operating-unit/contents/{+path}","compare_url":"https://api.github.com/repos/tschanzt/operating-unit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tschanzt/operating-unit/merges","archive_url":"https://api.github.com/repos/tschanzt/operating-unit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tschanzt/operating-unit/downloads","issues_url":"https://api.github.com/repos/tschanzt/operating-unit/issues{/number}","pulls_url":"https://api.github.com/repos/tschanzt/operating-unit/pulls{/number}","milestones_url":"https://api.github.com/repos/tschanzt/operating-unit/milestones{/number}","notifications_url":"https://api.github.com/repos/tschanzt/operating-unit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tschanzt/operating-unit/labels{/name}","releases_url":"https://api.github.com/repos/tschanzt/operating-unit/releases{/id}","deployments_url":"https://api.github.com/repos/tschanzt/operating-unit/deployments","created_at":"2018-02-22T16:47:52Z","updated_at":"2018-02-22T16:47:53Z","pushed_at":"2018-02-22T17:30:53Z","git_url":"git://github.com/tschanzt/operating-unit.git","ssh_url":"git@github.com:tschanzt/operating-unit.git","clone_url":"https://github.com/tschanzt/operating-unit.git","svn_url":"https://github.com/tschanzt/operating-unit","homepage":null,"size":381,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"11.0"}},"base":{"label":"OCA:11.0","ref":"11.0","sha":"99b7057f1576a9609ef695f6e8ae55c0bf186211","user":{"login":"OCA","id":7600578,"avatar_url":"https://avatars1.githubusercontent.com/u/7600578?v=4","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"repo":{"id":47409892,"name":"operating-unit","full_name":"OCA/operating-unit","owner":{"login":"OCA","id":7600578,"avatar_url":"https://avatars1.githubusercontent.com/u/7600578?v=4","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OCA/operating-unit","description":"Manage Operating Units in Odoo","fork":false,"url":"https://api.github.com/repos/OCA/operating-unit","forks_url":"https://api.github.com/repos/OCA/operating-unit/forks","keys_url":"https://api.github.com/repos/OCA/operating-unit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/operating-unit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/operating-unit/teams","hooks_url":"https://api.github.com/repos/OCA/operating-unit/hooks","issue_events_url":"https://api.github.com/repos/OCA/operating-unit/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/operating-unit/events","assignees_url":"https://api.github.com/repos/OCA/operating-unit/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/operating-unit/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/operating-unit/tags","blobs_url":"https://api.github.com/repos/OCA/operating-unit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/operating-unit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/operating-unit/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/operating-unit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/operating-unit/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/operating-unit/languages","stargazers_url":"https://api.github.com/repos/OCA/operating-unit/stargazers","contributors_url":"https://api.github.com/repos/OCA/operating-unit/contributors","subscribers_url":"https://api.github.com/repos/OCA/operating-unit/subscribers","subscription_url":"https://api.github.com/repos/OCA/operating-unit/subscription","commits_url":"https://api.github.com/repos/OCA/operating-unit/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/operating-unit/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/operating-unit/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/operating-unit/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/operating-unit/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/operating-unit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/operating-unit/merges","archive_url":"https://api.github.com/repos/OCA/operating-unit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/operating-unit/downloads","issues_url":"https://api.github.com/repos/OCA/operating-unit/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/operating-unit/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/operating-unit/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/operating-unit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/operating-unit/labels{/name}","releases_url":"https://api.github.com/repos/OCA/operating-unit/releases{/id}","deployments_url":"https://api.github.com/repos/OCA/operating-unit/deployments","created_at":"2015-12-04T14:51:11Z","updated_at":"2018-02-20T07:53:56Z","pushed_at":"2018-02-22T17:30:54Z","git_url":"git://github.com/OCA/operating-unit.git","ssh_url":"git@github.com:OCA/operating-unit.git","clone_url":"https://github.com/OCA/operating-unit.git","svn_url":"https://github.com/OCA/operating-unit","homepage":null,"size":376,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":46,"mirror_url":null,"archived":false,"open_issues_count":51,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":46,"open_issues":51,"watchers":10,"default_branch":"11.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/operating-unit/pulls/110"},"html":{"href":"https://github.com/OCA/operating-unit/pull/110"},"issue":{"href":"https://api.github.com/repos/OCA/operating-unit/issues/110"},"comments":{"href":"https://api.github.com/repos/OCA/operating-unit/issues/110/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/operating-unit/pulls/110/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/operating-unit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/operating-unit/pulls/110/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/operating-unit/statuses/3355ab2e2e9822298e1189f3c270a6b6cada6133"}},"author_association":"NONE"}}
{"actor":{"display_login":"grindtildeath"}}