GitHub PullRequestReviewCommentEvent at 2014-12-12 17:00:10
Repository: edition-mgmt
Actor: yvaucher
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/OCA/edition-mgmt/pulls/comments/21757319","id":21757319,"diff_hunk":"@@ -0,0 +1,134 @@\n+# -*- encoding: utf-8 -*-\n+# #############################################################################\n+#\n+# OpenERP, Open Source Management Solution\n+# This module copyright (C) 2014 Savoir-faire Linux\n+# (<http://www.savoirfairelinux.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+\n+import logging\n+from openerp.osv import fields, orm\n+from openerp import api\n+from openerp import tools\n+import ast\n+\n+_logger = logging.getLogger(__name__)\n+\n+\n+class publication_management(orm.Model):\n+    \"\"\"\n+    Publication Management table\n+    \"\"\"\n+    _name = 'publication.management'\n+    _description = 'Publication Management'\n+\n+    def create(self, cr, uid, vals, context=None):\n+        vals['name'] = self.pool.get('ir.sequence').get(\n+            cr, uid, 'seq.publication.management'\n+        )\n+        # Adding a condition here or even if a PM is created with a\n+        # partner_id in the context, the partner_id will be the one from\n+        # the user.\n+        if not vals.get('partner_id'):\n+            user = self.pool.get('res.users').browse(cr, uid, uid)\n+            vals['partner_id'] = user.partner_id.parent_id.id\n+        return super(publication_management, self).create(\n+            cr, uid, vals, context\n+        )\n+\n+    @api.multi\n+    def _get_image(self, name, args):\n+        return dict(\n+            (p.id, tools.image_get_resized_images(p.image)) for p in self)\n+\n+    @api.one\n+    def _set_image(self, name, value, args):\n+        return self.write({'image': tools.image_resize_image_big(value)})\n+\n+    _store_image = {'publication.management': (\n+        lambda self, cr, uid, ids, c={}: ids, ['image'], 10\n+    ),\n+    }\n+\n+    _columns = {\n+        'partner_id': fields.many2one('res.partner', string='Partner'),\n+        'title': fields.char('Title', size=128, required=True,\n+                             translate=False),\n+        'name': fields.text('Description', required=True, readonly=True),\n+        'image': fields.binary(\n+            'Image',\n+            help=\"This field holds the image used as avatar for this contact,\"\n+                 \"limited to 1024x1024px\"\n+        ),\n+        'image_medium': fields.function(\n+            _get_image,\n+            fnct_inv=_set_image,\n+            string=\"Medium-sized photo\",\n+            type=\"binary\", multi=\"_get_image\",\n+            store=_store_image,\n+            help=\"Medium-sized image of this publication. It is automatically \"\n+                 \"resized as a 128x128px image, with aspect ratio preserved. \"\n+                 \"Use this field in form views or some kanban views..\"\n+        ),\n+        'author': fields.char('Author', size=128, required=True,\n+                              translate=False),\n+        'genre': fields.many2many('publication.genre', id1='publication_id',\n+                                  id2='publication_genre_id',\n+                                  string='Genre'),\n+        'category': fields.many2many('publication.category',\n+                                     id1='publication_id',\n+                                     id2='publication_category_id',\n+                                     string='Category'),\n+    }\n+\n+    @api.multi\n+    def action_view_versions(self):\n+        act_obj = self.pool.get('ir.actions.act_window')","path":"publication_management/publication_management.py","position":100,"original_position":100,"commit_id":"2503685935ed4b7a64c012b434f5e6a3c92a423c","original_commit_id":"2503685935ed4b7a64c012b434f5e6a3c92a423c","user":{"login":"yvaucher","id":4158438,"avatar_url":"https://avatars.githubusercontent.com/u/4158438?v=3","gravatar_id":"","url":"https://api.github.com/users/yvaucher","html_url":"https://github.com/yvaucher","followers_url":"https://api.github.com/users/yvaucher/followers","following_url":"https://api.github.com/users/yvaucher/following{/other_user}","gists_url":"https://api.github.com/users/yvaucher/gists{/gist_id}","starred_url":"https://api.github.com/users/yvaucher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yvaucher/subscriptions","organizations_url":"https://api.github.com/users/yvaucher/orgs","repos_url":"https://api.github.com/users/yvaucher/repos","events_url":"https://api.github.com/users/yvaucher/events{/privacy}","received_events_url":"https://api.github.com/users/yvaucher/received_events","type":"User","site_admin":false},"body":"In new api `self.pool` has been replaced by `self.env['model']`","created_at":"2014-12-12T17:00:10Z","updated_at":"2014-12-12T17:00:10Z","html_url":"https://github.com/OCA/edition-mgmt/pull/3#discussion_r21757319","pull_request_url":"https://api.github.com/repos/OCA/edition-mgmt/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/OCA/edition-mgmt/pulls/comments/21757319"},"html":{"href":"https://github.com/OCA/edition-mgmt/pull/3#discussion_r21757319"},"pull_request":{"href":"https://api.github.com/repos/OCA/edition-mgmt/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/edition-mgmt/pulls/3","id":25602157,"html_url":"https://github.com/OCA/edition-mgmt/pull/3","diff_url":"https://github.com/OCA/edition-mgmt/pull/3.diff","patch_url":"https://github.com/OCA/edition-mgmt/pull/3.patch","issue_url":"https://api.github.com/repos/OCA/edition-mgmt/issues/3","number":3,"state":"open","locked":false,"title":"8.0 publication management","user":{"login":"foutoucour","id":547282,"avatar_url":"https://avatars.githubusercontent.com/u/547282?v=3","gravatar_id":"","url":"https://api.github.com/users/foutoucour","html_url":"https://github.com/foutoucour","followers_url":"https://api.github.com/users/foutoucour/followers","following_url":"https://api.github.com/users/foutoucour/following{/other_user}","gists_url":"https://api.github.com/users/foutoucour/gists{/gist_id}","starred_url":"https://api.github.com/users/foutoucour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foutoucour/subscriptions","organizations_url":"https://api.github.com/users/foutoucour/orgs","repos_url":"https://api.github.com/users/foutoucour/repos","events_url":"https://api.github.com/users/foutoucour/events{/privacy}","received_events_url":"https://api.github.com/users/foutoucour/received_events","type":"User","site_admin":false},"body":"This module adds a new menu entry, \"publication (en), oeuvre (fr)\".\r\nIt was created in order to regroup different versions (product.product) under +one same parent publication.\r\nIt also adds search and kanban views.","created_at":"2014-12-05T21:40:28Z","updated_at":"2014-12-12T17:00:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4bebcea770853303c511f0ee7f3ba7a63080532d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OCA/edition-mgmt/pulls/3/commits","review_comments_url":"https://api.github.com/repos/OCA/edition-mgmt/pulls/3/comments","review_comment_url":"https://api.github.com/repos/OCA/edition-mgmt/pulls/comments/{number}","comments_url":"https://api.github.com/repos/OCA/edition-mgmt/issues/3/comments","statuses_url":"https://api.github.com/repos/OCA/edition-mgmt/statuses/2503685935ed4b7a64c012b434f5e6a3c92a423c","head":{"label":"savoirfairelinux:8.0-publication_management","ref":"8.0-publication_management","sha":"2503685935ed4b7a64c012b434f5e6a3c92a423c","user":{"login":"savoirfairelinux","id":2735545,"avatar_url":"https://avatars.githubusercontent.com/u/2735545?v=3","gravatar_id":"","url":"https://api.github.com/users/savoirfairelinux","html_url":"https://github.com/savoirfairelinux","followers_url":"https://api.github.com/users/savoirfairelinux/followers","following_url":"https://api.github.com/users/savoirfairelinux/following{/other_user}","gists_url":"https://api.github.com/users/savoirfairelinux/gists{/gist_id}","starred_url":"https://api.github.com/users/savoirfairelinux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/savoirfairelinux/subscriptions","organizations_url":"https://api.github.com/users/savoirfairelinux/orgs","repos_url":"https://api.github.com/users/savoirfairelinux/repos","events_url":"https://api.github.com/users/savoirfairelinux/events{/privacy}","received_events_url":"https://api.github.com/users/savoirfairelinux/received_events","type":"Organization","site_admin":false},"repo":{"id":24652067,"name":"edition-mgmt","full_name":"savoirfairelinux/edition-mgmt","owner":{"login":"savoirfairelinux","id":2735545,"avatar_url":"https://avatars.githubusercontent.com/u/2735545?v=3","gravatar_id":"","url":"https://api.github.com/users/savoirfairelinux","html_url":"https://github.com/savoirfairelinux","followers_url":"https://api.github.com/users/savoirfairelinux/followers","following_url":"https://api.github.com/users/savoirfairelinux/following{/other_user}","gists_url":"https://api.github.com/users/savoirfairelinux/gists{/gist_id}","starred_url":"https://api.github.com/users/savoirfairelinux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/savoirfairelinux/subscriptions","organizations_url":"https://api.github.com/users/savoirfairelinux/orgs","repos_url":"https://api.github.com/users/savoirfairelinux/repos","events_url":"https://api.github.com/users/savoirfairelinux/events{/privacy}","received_events_url":"https://api.github.com/users/savoirfairelinux/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/savoirfairelinux/edition-mgmt","description":"","fork":true,"url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt","forks_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/forks","keys_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/teams","hooks_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/hooks","issue_events_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/issues/events{/number}","events_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/events","assignees_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/assignees{/user}","branches_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/branches{/branch}","tags_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/tags","blobs_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/git/refs{/sha}","trees_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/statuses/{sha}","languages_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/languages","stargazers_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/stargazers","contributors_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/contributors","subscribers_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/subscribers","subscription_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/subscription","commits_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/commits{/sha}","git_commits_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/git/commits{/sha}","comments_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/comments{/number}","issue_comment_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/issues/comments/{number}","contents_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/contents/{+path}","compare_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/merges","archive_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/downloads","issues_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/issues{/number}","pulls_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/pulls{/number}","milestones_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/milestones{/number}","notifications_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/labels{/name}","releases_url":"https://api.github.com/repos/savoirfairelinux/edition-mgmt/releases{/id}","created_at":"2014-09-30T19:19:32Z","updated_at":"2014-11-26T15:16:08Z","pushed_at":"2014-12-08T22:00:03Z","git_url":"git://github.com/savoirfairelinux/edition-mgmt.git","ssh_url":"git@github.com:savoirfairelinux/edition-mgmt.git","clone_url":"https://github.com/savoirfairelinux/edition-mgmt.git","svn_url":"https://github.com/savoirfairelinux/edition-mgmt","homepage":null,"size":826,"stargazers_count":0,"watchers_count":0,"language":null,"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:8.0","ref":"8.0","sha":"1d94bf22ef68e22b36beec29f2f0b4753276777b","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":20897315,"name":"edition-mgmt","full_name":"OCA/edition-mgmt","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/edition-mgmt","description":"","fork":false,"url":"https://api.github.com/repos/OCA/edition-mgmt","forks_url":"https://api.github.com/repos/OCA/edition-mgmt/forks","keys_url":"https://api.github.com/repos/OCA/edition-mgmt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/edition-mgmt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/edition-mgmt/teams","hooks_url":"https://api.github.com/repos/OCA/edition-mgmt/hooks","issue_events_url":"https://api.github.com/repos/OCA/edition-mgmt/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/edition-mgmt/events","assignees_url":"https://api.github.com/repos/OCA/edition-mgmt/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/edition-mgmt/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/edition-mgmt/tags","blobs_url":"https://api.github.com/repos/OCA/edition-mgmt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/edition-mgmt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/edition-mgmt/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/edition-mgmt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/edition-mgmt/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/edition-mgmt/languages","stargazers_url":"https://api.github.com/repos/OCA/edition-mgmt/stargazers","contributors_url":"https://api.github.com/repos/OCA/edition-mgmt/contributors","subscribers_url":"https://api.github.com/repos/OCA/edition-mgmt/subscribers","subscription_url":"https://api.github.com/repos/OCA/edition-mgmt/subscription","commits_url":"https://api.github.com/repos/OCA/edition-mgmt/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/edition-mgmt/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/edition-mgmt/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/edition-mgmt/issues/comments/{number}","contents_url":"https://api.github.com/repos/OCA/edition-mgmt/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/edition-mgmt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/edition-mgmt/merges","archive_url":"https://api.github.com/repos/OCA/edition-mgmt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/edition-mgmt/downloads","issues_url":"https://api.github.com/repos/OCA/edition-mgmt/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/edition-mgmt/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/edition-mgmt/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/edition-mgmt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/edition-mgmt/labels{/name}","releases_url":"https://api.github.com/repos/OCA/edition-mgmt/releases{/id}","created_at":"2014-06-16T19:15:02Z","updated_at":"2014-06-16T19:15:03Z","pushed_at":"2014-09-30T19:39:44Z","git_url":"git://github.com/OCA/edition-mgmt.git","ssh_url":"git@github.com:OCA/edition-mgmt.git","clone_url":"https://github.com/OCA/edition-mgmt.git","svn_url":"https://github.com/OCA/edition-mgmt","homepage":null,"size":104,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":0,"default_branch":"8.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/edition-mgmt/pulls/3"},"html":{"href":"https://github.com/OCA/edition-mgmt/pull/3"},"issue":{"href":"https://api.github.com/repos/OCA/edition-mgmt/issues/3"},"comments":{"href":"https://api.github.com/repos/OCA/edition-mgmt/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/edition-mgmt/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/edition-mgmt/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/OCA/edition-mgmt/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/edition-mgmt/statuses/2503685935ed4b7a64c012b434f5e6a3c92a423c"}}}}