{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/account-analytic/pulls/comments/60671292","id":60671292,"diff_hunk":"@@ -0,0 +1,66 @@\n+# -*- coding: utf-8 -*-\n+# © 2016  Laetitia Gangloff, Acsone SA/NV (http://www.acsone.eu)\n+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n+\n+from openerp import api, fields, models\n+\n+\n+class PurchaseOrder(models.Model):\n+    _inherit = 'purchase.order'\n+\n+    project_id2 = fields.Many2one(\n+        comodel_name='account.analytic.account',\n+        string='Contract / Analytic',\n+        help='Use to store the value of project_id if there is no lines')\n+    project_id = fields.Many2one(\n+        compute='_compute_project_id',\n+        inverse='_inverse_project_id',\n+        comodel_name='account.analytic.account',\n+        string='Contract / Analytic', readonly=True,\n+        states={'draft': [('readonly', False)]},\n+        store=True,\n+        help=\"The analytic account related to a sales order.\")\n+\n+    @api.one\n+    @api.depends('order_line.account_analytic_id')\n+    def _compute_project_id(self):\n+        \"\"\" If all order line have same analytic account set project_id\n+        \"\"\"\n+        al = self.project_id2\n+        if self.order_line:\n+            al = (self.order_line[0].account_analytic_id) or False\n+            for ol in self.order_line:\n+                if ol.account_analytic_id != al:\n+                    al = False\n+                    break\n+        self.project_id = al\n+\n+    @api.one","path":"purchase_analytic/models/purchase.py","position":38,"original_position":38,"commit_id":"47554a88470176bb69f3851cbd0c404e49653f31","original_commit_id":"47554a88470176bb69f3851cbd0c404e49653f31","user":{"login":"andhit-r","id":1947376,"avatar_url":"https://avatars.githubusercontent.com/u/1947376?v=3","gravatar_id":"","url":"https://api.github.com/users/andhit-r","html_url":"https://github.com/andhit-r","followers_url":"https://api.github.com/users/andhit-r/followers","following_url":"https://api.github.com/users/andhit-r/following{/other_user}","gists_url":"https://api.github.com/users/andhit-r/gists{/gist_id}","starred_url":"https://api.github.com/users/andhit-r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andhit-r/subscriptions","organizations_url":"https://api.github.com/users/andhit-r/orgs","repos_url":"https://api.github.com/users/andhit-r/repos","events_url":"https://api.github.com/users/andhit-r/events{/privacy}","received_events_url":"https://api.github.com/users/andhit-r/received_events","type":"User","site_admin":false},"body":"@api.one deprecated","created_at":"2016-04-21T23:29:46Z","updated_at":"2016-04-21T23:29:46Z","html_url":"https://github.com/OCA/account-analytic/pull/55#discussion_r60671292","pull_request_url":"https://api.github.com/repos/OCA/account-analytic/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/OCA/account-analytic/pulls/comments/60671292"},"html":{"href":"https://github.com/OCA/account-analytic/pull/55#discussion_r60671292"},"pull_request":{"href":"https://api.github.com/repos/OCA/account-analytic/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/account-analytic/pulls/55","id":65628761,"html_url":"https://github.com/OCA/account-analytic/pull/55","diff_url":"https://github.com/OCA/account-analytic/pull/55.diff","patch_url":"https://github.com/OCA/account-analytic/pull/55.patch","issue_url":"https://api.github.com/repos/OCA/account-analytic/issues/55","number":55,"state":"open","locked":false,"title":"[ADD] module to manage analytic on purchase order","user":{"login":"laetitia-gangloff","id":7602419,"avatar_url":"https://avatars.githubusercontent.com/u/7602419?v=3","gravatar_id":"","url":"https://api.github.com/users/laetitia-gangloff","html_url":"https://github.com/laetitia-gangloff","followers_url":"https://api.github.com/users/laetitia-gangloff/followers","following_url":"https://api.github.com/users/laetitia-gangloff/following{/other_user}","gists_url":"https://api.github.com/users/laetitia-gangloff/gists{/gist_id}","starred_url":"https://api.github.com/users/laetitia-gangloff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laetitia-gangloff/subscriptions","organizations_url":"https://api.github.com/users/laetitia-gangloff/orgs","repos_url":"https://api.github.com/users/laetitia-gangloff/repos","events_url":"https://api.github.com/users/laetitia-gangloff/events{/privacy}","received_events_url":"https://api.github.com/users/laetitia-gangloff/received_events","type":"User","site_admin":false},"body":"This module allow user to set analytic account on purchase order instead of purchase order line.\r\nWhen analytic account is set on purchase order, all lines of this purchase order will be on this analytic account.","created_at":"2016-04-07T13:22:04Z","updated_at":"2016-04-21T23:29:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8e95b5253d9f05ff396f8562bba0f73e528ba22","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OCA/account-analytic/pulls/55/commits","review_comments_url":"https://api.github.com/repos/OCA/account-analytic/pulls/55/comments","review_comment_url":"https://api.github.com/repos/OCA/account-analytic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/account-analytic/issues/55/comments","statuses_url":"https://api.github.com/repos/OCA/account-analytic/statuses/47554a88470176bb69f3851cbd0c404e49653f31","head":{"label":"acsone:8.0-purchase_analytic-lga","ref":"8.0-purchase_analytic-lga","sha":"47554a88470176bb69f3851cbd0c404e49653f31","user":{"login":"acsone","id":7601056,"avatar_url":"https://avatars.githubusercontent.com/u/7601056?v=3","gravatar_id":"","url":"https://api.github.com/users/acsone","html_url":"https://github.com/acsone","followers_url":"https://api.github.com/users/acsone/followers","following_url":"https://api.github.com/users/acsone/following{/other_user}","gists_url":"https://api.github.com/users/acsone/gists{/gist_id}","starred_url":"https://api.github.com/users/acsone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acsone/subscriptions","organizations_url":"https://api.github.com/users/acsone/orgs","repos_url":"https://api.github.com/users/acsone/repos","events_url":"https://api.github.com/users/acsone/events{/privacy}","received_events_url":"https://api.github.com/users/acsone/received_events","type":"Organization","site_admin":false},"repo":{"id":23571432,"name":"account-analytic","full_name":"acsone/account-analytic","owner":{"login":"acsone","id":7601056,"avatar_url":"https://avatars.githubusercontent.com/u/7601056?v=3","gravatar_id":"","url":"https://api.github.com/users/acsone","html_url":"https://github.com/acsone","followers_url":"https://api.github.com/users/acsone/followers","following_url":"https://api.github.com/users/acsone/following{/other_user}","gists_url":"https://api.github.com/users/acsone/gists{/gist_id}","starred_url":"https://api.github.com/users/acsone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acsone/subscriptions","organizations_url":"https://api.github.com/users/acsone/orgs","repos_url":"https://api.github.com/users/acsone/repos","events_url":"https://api.github.com/users/acsone/events{/privacy}","received_events_url":"https://api.github.com/users/acsone/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/acsone/account-analytic","description":"","fork":true,"url":"https://api.github.com/repos/acsone/account-analytic","forks_url":"https://api.github.com/repos/acsone/account-analytic/forks","keys_url":"https://api.github.com/repos/acsone/account-analytic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/acsone/account-analytic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/acsone/account-analytic/teams","hooks_url":"https://api.github.com/repos/acsone/account-analytic/hooks","issue_events_url":"https://api.github.com/repos/acsone/account-analytic/issues/events{/number}","events_url":"https://api.github.com/repos/acsone/account-analytic/events","assignees_url":"https://api.github.com/repos/acsone/account-analytic/assignees{/user}","branches_url":"https://api.github.com/repos/acsone/account-analytic/branches{/branch}","tags_url":"https://api.github.com/repos/acsone/account-analytic/tags","blobs_url":"https://api.github.com/repos/acsone/account-analytic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/acsone/account-analytic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/acsone/account-analytic/git/refs{/sha}","trees_url":"https://api.github.com/repos/acsone/account-analytic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/acsone/account-analytic/statuses/{sha}","languages_url":"https://api.github.com/repos/acsone/account-analytic/languages","stargazers_url":"https://api.github.com/repos/acsone/account-analytic/stargazers","contributors_url":"https://api.github.com/repos/acsone/account-analytic/contributors","subscribers_url":"https://api.github.com/repos/acsone/account-analytic/subscribers","subscription_url":"https://api.github.com/repos/acsone/account-analytic/subscription","commits_url":"https://api.github.com/repos/acsone/account-analytic/commits{/sha}","git_commits_url":"https://api.github.com/repos/acsone/account-analytic/git/commits{/sha}","comments_url":"https://api.github.com/repos/acsone/account-analytic/comments{/number}","issue_comment_url":"https://api.github.com/repos/acsone/account-analytic/issues/comments{/number}","contents_url":"https://api.github.com/repos/acsone/account-analytic/contents/{+path}","compare_url":"https://api.github.com/repos/acsone/account-analytic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/acsone/account-analytic/merges","archive_url":"https://api.github.com/repos/acsone/account-analytic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/acsone/account-analytic/downloads","issues_url":"https://api.github.com/repos/acsone/account-analytic/issues{/number}","pulls_url":"https://api.github.com/repos/acsone/account-analytic/pulls{/number}","milestones_url":"https://api.github.com/repos/acsone/account-analytic/milestones{/number}","notifications_url":"https://api.github.com/repos/acsone/account-analytic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/acsone/account-analytic/labels{/name}","releases_url":"https://api.github.com/repos/acsone/account-analytic/releases{/id}","deployments_url":"https://api.github.com/repos/acsone/account-analytic/deployments","created_at":"2014-09-02T08:46:12Z","updated_at":"2016-01-20T00:00:15Z","pushed_at":"2016-04-21T09:48:30Z","git_url":"git://github.com/acsone/account-analytic.git","ssh_url":"git@github.com:acsone/account-analytic.git","clone_url":"https://github.com/acsone/account-analytic.git","svn_url":"https://github.com/acsone/account-analytic","homepage":null,"size":411,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"5e992f08b7099dfee6c824e837e581b8a50e6276","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":20881668,"name":"account-analytic","full_name":"OCA/account-analytic","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/account-analytic","description":"Odoo Account Analytic Related Addons","fork":false,"url":"https://api.github.com/repos/OCA/account-analytic","forks_url":"https://api.github.com/repos/OCA/account-analytic/forks","keys_url":"https://api.github.com/repos/OCA/account-analytic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/account-analytic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/account-analytic/teams","hooks_url":"https://api.github.com/repos/OCA/account-analytic/hooks","issue_events_url":"https://api.github.com/repos/OCA/account-analytic/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/account-analytic/events","assignees_url":"https://api.github.com/repos/OCA/account-analytic/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/account-analytic/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/account-analytic/tags","blobs_url":"https://api.github.com/repos/OCA/account-analytic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/account-analytic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/account-analytic/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/account-analytic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/account-analytic/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/account-analytic/languages","stargazers_url":"https://api.github.com/repos/OCA/account-analytic/stargazers","contributors_url":"https://api.github.com/repos/OCA/account-analytic/contributors","subscribers_url":"https://api.github.com/repos/OCA/account-analytic/subscribers","subscription_url":"https://api.github.com/repos/OCA/account-analytic/subscription","commits_url":"https://api.github.com/repos/OCA/account-analytic/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/account-analytic/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/account-analytic/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/account-analytic/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/account-analytic/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/account-analytic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/account-analytic/merges","archive_url":"https://api.github.com/repos/OCA/account-analytic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/account-analytic/downloads","issues_url":"https://api.github.com/repos/OCA/account-analytic/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/account-analytic/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/account-analytic/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/account-analytic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/account-analytic/labels{/name}","releases_url":"https://api.github.com/repos/OCA/account-analytic/releases{/id}","deployments_url":"https://api.github.com/repos/OCA/account-analytic/deployments","created_at":"2014-06-16T10:55:18Z","updated_at":"2016-01-27T14:38:14Z","pushed_at":"2016-04-14T02:42:26Z","git_url":"git://github.com/OCA/account-analytic.git","ssh_url":"git@github.com:OCA/account-analytic.git","clone_url":"https://github.com/OCA/account-analytic.git","svn_url":"https://github.com/OCA/account-analytic","homepage":"","size":503,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":7,"forks":42,"open_issues":7,"watchers":6,"default_branch":"9.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/account-analytic/pulls/55"},"html":{"href":"https://github.com/OCA/account-analytic/pull/55"},"issue":{"href":"https://api.github.com/repos/OCA/account-analytic/issues/55"},"comments":{"href":"https://api.github.com/repos/OCA/account-analytic/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/account-analytic/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/account-analytic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/account-analytic/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/account-analytic/statuses/47554a88470176bb69f3851cbd0c404e49653f31"}}}}