{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/web/pulls/comments/84651810","pull_request_review_id":5414704,"id":84651810,"diff_hunk":"@@ -0,0 +1,116 @@\n+# -*- coding: utf-8 -*-\n+##############################################################################\n+#\n+#    OpenERP, Open Source Management Solution\n+#    Copyright (C) 2010-2014 OpenERP s.a. (<http://openerp.com>).\n+#    Copyright (C) 2014 initOS GmbH(<http://www.initos.com>).\n+#\n+#    This program is free software: you can redistribute it and/or modify\n+#    it under the terms of the GNU Affero General Public License as\n+#    published by the Free Software Foundation, either version 3 of the\n+#    License, or (at your option) any later version.\n+#\n+#    This program is distributed in the hope that it will be useful,\n+#    but WITHOUT ANY WARRANTY; without even the implied warranty of\n+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+#    GNU Affero General Public License for more details.\n+#\n+#    You should have received a copy of the GNU Affero General Public License\n+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+#\n+##############################################################################\n+from openerp.osv import orm, fields\n+import re\n+\n+\n+def remove_html_tags(data):\n+    p = re.compile(r'<.*?>')\n+    return p.sub('', data)\n+\n+\n+def remove_extra_spaces(data):\n+    p = re.compile(r'\\s+')\n+    return p.sub(' ', data)\n+\n+\n+def _type_selection(self, *args, **kwargs):\n+    \"\"\"Redirect for easier overwriting.\"\"\"\n+    return self.pool.get('web.note').type_selection(*args, **kwargs)\n+\n+\n+class web_note(orm.Model):\n+    _name = 'web.note'\n+\n+    def name_get(self, cr, uid, ids, context=None):\n+        if context is None:\n+            context = {}\n+        if isinstance(ids, (int, long)):\n+            ids = [ids]\n+        res = []\n+        for record in self.browse(cr, uid, ids, context=context):\n+            name = remove_extra_spaces(remove_html_tags(record.message or ''))\n+\n+            res.append((record.id, name))\n+        return res\n+\n+    def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):\n+        res = self.name_get(cr, uid, ids, context=context)\n+        return dict(res)\n+\n+    def type_selection(self, cr, uid, context=None):\n+        return (('private', 'private'),\n+                ('internal', 'internal'),\n+                ('external', 'external'))\n+\n+    def onchange_container_id(self, cr, uid, ids,\n+                              container_id=False, message=None, context=None):\n+        result = {}\n+        if container_id:\n+            container = self.pool.get('web.note.container').\\\n+                browse(cr, uid, container_id, context=context)\n+            result['value'] = {\n+                'sequence':\n+                    container.sequence or self._defaults.get('sequence', 0),\n+                }\n+            if container.pattern:\n+                result['value']['message'] = container.pattern\n+        return result\n+\n+    _order = 'sequence,create_date'\n+\n+    _columns = {\n+        'type': fields.selection(_type_selection, 'Note type', required=True),\n+        'message': fields.html('Message'),\n+        'display_name':\n+            fields.function(_name_get_fnc,\n+                            type=\"char\", string='Note', store=False),\n+        'container_id': fields.many2one('web.note.container', 'Note-Container',\n+                                        help='Containers include '\n+                                        'templates for order and heading.'),\n+        'sequence': fields.integer('Order in report'),\n+        'create_uid': fields.many2one('res.users', 'User', readonly=True),\n+    }\n+\n+    _defaults = {\n+        'sequence': 10,\n+    }\n+\n+\n+class web_note_container(orm.Model):","path":"web_note/web_note.py","position":99,"original_position":99,"commit_id":"0e7f9b98cd3051129ae09f65a33a74cf69a0df25","original_commit_id":"0e7f9b98cd3051129ae09f65a33a74cf69a0df25","user":{"login":"pedrobaeza","id":7165771,"avatar_url":"https://avatars.githubusercontent.com/u/7165771?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrobaeza","html_url":"https://github.com/pedrobaeza","followers_url":"https://api.github.com/users/pedrobaeza/followers","following_url":"https://api.github.com/users/pedrobaeza/following{/other_user}","gists_url":"https://api.github.com/users/pedrobaeza/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrobaeza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrobaeza/subscriptions","organizations_url":"https://api.github.com/users/pedrobaeza/orgs","repos_url":"https://api.github.com/users/pedrobaeza/repos","events_url":"https://api.github.com/users/pedrobaeza/events{/privacy}","received_events_url":"https://api.github.com/users/pedrobaeza/received_events","type":"User","site_admin":false},"body":"CamelCase","created_at":"2016-10-24T09:40:04Z","updated_at":"2016-10-24T09:42:05Z","html_url":"https://github.com/OCA/web/pull/216#discussion_r84651810","pull_request_url":"https://api.github.com/repos/OCA/web/pulls/216","_links":{"self":{"href":"https://api.github.com/repos/OCA/web/pulls/comments/84651810"},"html":{"href":"https://github.com/OCA/web/pull/216#discussion_r84651810"},"pull_request":{"href":"https://api.github.com/repos/OCA/web/pulls/216"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/web/pulls/216","id":44328653,"html_url":"https://github.com/OCA/web/pull/216","diff_url":"https://github.com/OCA/web/pull/216.diff","patch_url":"https://github.com/OCA/web/pull/216.patch","issue_url":"https://api.github.com/repos/OCA/web/issues/216","number":216,"state":"open","locked":false,"title":"7.0 add web note and web note test","user":{"login":"ntodorova","id":8202244,"avatar_url":"https://avatars.githubusercontent.com/u/8202244?v=3","gravatar_id":"","url":"https://api.github.com/users/ntodorova","html_url":"https://github.com/ntodorova","followers_url":"https://api.github.com/users/ntodorova/followers","following_url":"https://api.github.com/users/ntodorova/following{/other_user}","gists_url":"https://api.github.com/users/ntodorova/gists{/gist_id}","starred_url":"https://api.github.com/users/ntodorova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntodorova/subscriptions","organizations_url":"https://api.github.com/users/ntodorova/orgs","repos_url":"https://api.github.com/users/ntodorova/repos","events_url":"https://api.github.com/users/ntodorova/events{/privacy}","received_events_url":"https://api.github.com/users/ntodorova/received_events","type":"User","site_admin":false},"body":"This module can be used for adding a notes field in any module that need them.\r\nThere are three type of notes - private, internal, external. \r\nOnly the user that create a private note can see it. The other two types can be used for creating different views.\r\nThere is also a test module that shows use case.","created_at":"2015-09-07T07:56:00Z","updated_at":"2016-10-24T09:42:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"89250afa2a9cede4ad6c2435144753f1619a6cde","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/OCA/web/milestones/2","html_url":"https://github.com/OCA/web/milestones/7.0","labels_url":"https://api.github.com/repos/OCA/web/milestones/2/labels","id":819640,"number":2,"title":"7.0","description":"","creator":{"login":"legalsylvain","id":3407482,"avatar_url":"https://avatars.githubusercontent.com/u/3407482?v=3","gravatar_id":"","url":"https://api.github.com/users/legalsylvain","html_url":"https://github.com/legalsylvain","followers_url":"https://api.github.com/users/legalsylvain/followers","following_url":"https://api.github.com/users/legalsylvain/following{/other_user}","gists_url":"https://api.github.com/users/legalsylvain/gists{/gist_id}","starred_url":"https://api.github.com/users/legalsylvain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/legalsylvain/subscriptions","organizations_url":"https://api.github.com/users/legalsylvain/orgs","repos_url":"https://api.github.com/users/legalsylvain/repos","events_url":"https://api.github.com/users/legalsylvain/events{/privacy}","received_events_url":"https://api.github.com/users/legalsylvain/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":40,"state":"open","created_at":"2014-10-09T10:16:24Z","updated_at":"2016-10-20T13:04:30Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/OCA/web/pulls/216/commits","review_comments_url":"https://api.github.com/repos/OCA/web/pulls/216/comments","review_comment_url":"https://api.github.com/repos/OCA/web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/web/issues/216/comments","statuses_url":"https://api.github.com/repos/OCA/web/statuses/0e7f9b98cd3051129ae09f65a33a74cf69a0df25","head":{"label":"initOS:7.0-add_web_note_and_web_note_test","ref":"7.0-add_web_note_and_web_note_test","sha":"0e7f9b98cd3051129ae09f65a33a74cf69a0df25","user":{"login":"initOS","id":4948110,"avatar_url":"https://avatars.githubusercontent.com/u/4948110?v=3","gravatar_id":"","url":"https://api.github.com/users/initOS","html_url":"https://github.com/initOS","followers_url":"https://api.github.com/users/initOS/followers","following_url":"https://api.github.com/users/initOS/following{/other_user}","gists_url":"https://api.github.com/users/initOS/gists{/gist_id}","starred_url":"https://api.github.com/users/initOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/initOS/subscriptions","organizations_url":"https://api.github.com/users/initOS/orgs","repos_url":"https://api.github.com/users/initOS/repos","events_url":"https://api.github.com/users/initOS/events{/privacy}","received_events_url":"https://api.github.com/users/initOS/received_events","type":"Organization","site_admin":false},"repo":{"id":24058779,"name":"web","full_name":"initOS/web","owner":{"login":"initOS","id":4948110,"avatar_url":"https://avatars.githubusercontent.com/u/4948110?v=3","gravatar_id":"","url":"https://api.github.com/users/initOS","html_url":"https://github.com/initOS","followers_url":"https://api.github.com/users/initOS/followers","following_url":"https://api.github.com/users/initOS/following{/other_user}","gists_url":"https://api.github.com/users/initOS/gists{/gist_id}","starred_url":"https://api.github.com/users/initOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/initOS/subscriptions","organizations_url":"https://api.github.com/users/initOS/orgs","repos_url":"https://api.github.com/users/initOS/repos","events_url":"https://api.github.com/users/initOS/events{/privacy}","received_events_url":"https://api.github.com/users/initOS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/initOS/web","description":null,"fork":true,"url":"https://api.github.com/repos/initOS/web","forks_url":"https://api.github.com/repos/initOS/web/forks","keys_url":"https://api.github.com/repos/initOS/web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/initOS/web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/initOS/web/teams","hooks_url":"https://api.github.com/repos/initOS/web/hooks","issue_events_url":"https://api.github.com/repos/initOS/web/issues/events{/number}","events_url":"https://api.github.com/repos/initOS/web/events","assignees_url":"https://api.github.com/repos/initOS/web/assignees{/user}","branches_url":"https://api.github.com/repos/initOS/web/branches{/branch}","tags_url":"https://api.github.com/repos/initOS/web/tags","blobs_url":"https://api.github.com/repos/initOS/web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/initOS/web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/initOS/web/git/refs{/sha}","trees_url":"https://api.github.com/repos/initOS/web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/initOS/web/statuses/{sha}","languages_url":"https://api.github.com/repos/initOS/web/languages","stargazers_url":"https://api.github.com/repos/initOS/web/stargazers","contributors_url":"https://api.github.com/repos/initOS/web/contributors","subscribers_url":"https://api.github.com/repos/initOS/web/subscribers","subscription_url":"https://api.github.com/repos/initOS/web/subscription","commits_url":"https://api.github.com/repos/initOS/web/commits{/sha}","git_commits_url":"https://api.github.com/repos/initOS/web/git/commits{/sha}","comments_url":"https://api.github.com/repos/initOS/web/comments{/number}","issue_comment_url":"https://api.github.com/repos/initOS/web/issues/comments{/number}","contents_url":"https://api.github.com/repos/initOS/web/contents/{+path}","compare_url":"https://api.github.com/repos/initOS/web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/initOS/web/merges","archive_url":"https://api.github.com/repos/initOS/web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/initOS/web/downloads","issues_url":"https://api.github.com/repos/initOS/web/issues{/number}","pulls_url":"https://api.github.com/repos/initOS/web/pulls{/number}","milestones_url":"https://api.github.com/repos/initOS/web/milestones{/number}","notifications_url":"https://api.github.com/repos/initOS/web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/initOS/web/labels{/name}","releases_url":"https://api.github.com/repos/initOS/web/releases{/id}","deployments_url":"https://api.github.com/repos/initOS/web/deployments","created_at":"2014-09-15T14:08:34Z","updated_at":"2015-06-04T22:33:44Z","pushed_at":"2016-10-24T09:31:52Z","git_url":"git://github.com/initOS/web.git","ssh_url":"git@github.com:initOS/web.git","clone_url":"https://github.com/initOS/web.git","svn_url":"https://github.com/initOS/web","homepage":null,"size":9189,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"8.0"}},"base":{"label":"OCA:7.0","ref":"7.0","sha":"048d2935400fe24b07bb2f1e3c55aeb140ab7e70","user":{"login":"OCA","id":7600578,"avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=3","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":20895915,"name":"web","full_name":"OCA/web","owner":{"login":"OCA","id":7600578,"avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=3","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/web","description":"Odoo web client UI related addons","fork":false,"url":"https://api.github.com/repos/OCA/web","forks_url":"https://api.github.com/repos/OCA/web/forks","keys_url":"https://api.github.com/repos/OCA/web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/web/teams","hooks_url":"https://api.github.com/repos/OCA/web/hooks","issue_events_url":"https://api.github.com/repos/OCA/web/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/web/events","assignees_url":"https://api.github.com/repos/OCA/web/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/web/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/web/tags","blobs_url":"https://api.github.com/repos/OCA/web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/web/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/web/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/web/languages","stargazers_url":"https://api.github.com/repos/OCA/web/stargazers","contributors_url":"https://api.github.com/repos/OCA/web/contributors","subscribers_url":"https://api.github.com/repos/OCA/web/subscribers","subscription_url":"https://api.github.com/repos/OCA/web/subscription","commits_url":"https://api.github.com/repos/OCA/web/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/web/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/web/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/web/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/web/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/web/merges","archive_url":"https://api.github.com/repos/OCA/web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/web/downloads","issues_url":"https://api.github.com/repos/OCA/web/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/web/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/web/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/web/labels{/name}","releases_url":"https://api.github.com/repos/OCA/web/releases{/id}","deployments_url":"https://api.github.com/repos/OCA/web/deployments","created_at":"2014-06-16T18:34:12Z","updated_at":"2016-10-21T06:17:50Z","pushed_at":"2016-10-22T23:11:02Z","git_url":"git://github.com/OCA/web.git","ssh_url":"git@github.com:OCA/web.git","clone_url":"https://github.com/OCA/web.git","svn_url":"https://github.com/OCA/web","homepage":"","size":16319,"stargazers_count":119,"watchers_count":119,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":341,"mirror_url":null,"open_issues_count":69,"forks":341,"open_issues":69,"watchers":119,"default_branch":"10.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/web/pulls/216"},"html":{"href":"https://github.com/OCA/web/pull/216"},"issue":{"href":"https://api.github.com/repos/OCA/web/issues/216"},"comments":{"href":"https://api.github.com/repos/OCA/web/issues/216/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/web/pulls/216/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/web/pulls/216/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/web/statuses/0e7f9b98cd3051129ae09f65a33a74cf69a0df25"}}}}
{"actor":{"display_login":"pedrobaeza"}}