{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/comments/34365197","id":34365197,"diff_hunk":"@@ -18,69 +18,59 @@\n #\n ##############################################################################\n \n-from openerp.osv import fields, orm\n+from openerp import models, api, fields\n \n \n-class stock_move(orm.Model):\n+class StockMove(models.Model):\n     _inherit = \"stock.move\"\n \n-    _columns = {\n-        'invoice_line_id': fields.many2one(\n-            'account.invoice.line', 'Invoice Line', readonly=True),\n-    }\n+    invoice_line_id = fields.Many2one(comodel_name='account.invoice.line',\n+                                      string='Invoice Line', readonly=True)\n \n-    def _create_invoice_line_from_vals(\n-            self, cr, uid, move, invoice_line_vals, context=None):\n-        inv_line_id = super(stock_move, self)._create_invoice_line_from_vals(\n-            cr, uid, move, invoice_line_vals, context=context)\n-        move.write({'invoice_line_id': inv_line_id})\n+    @api.model\n+    def _create_invoice_line_from_vals(self, move, invoice_line_vals):\n+        inv_line_id = super(StockMove, self)._create_invoice_line_from_vals(\n+            move, invoice_line_vals)\n+        move.invoice_line_id = inv_line_id\n         move.picking_id.invoice_id = invoice_line_vals['invoice_id']\n         return inv_line_id\n \n \n-class stock_picking(orm.Model):\n+class StockPicking(models.Model):\n     _inherit = \"stock.picking\"\n \n-    def _get_invoice_view_xmlid(self, cr, uid, ids, name, arg, context=None):\n-        res = {}\n-        for pick in self.browse(cr, uid, ids, context=context):\n+    @api.multi\n+    def _get_invoice_view_xmlid(self):\n+        for pick in self:\n             if pick.invoice_id:\n                 if pick.invoice_id.type in ('in_invoice', 'in_refund'):\n-                    res[pick.id] = 'account.invoice_supplier_form'\n+                    pick.invoice_view_xmlid = 'account.invoice_supplier_form'\n                 else:\n-                    res[pick.id] = 'account.invoice_form'\n-            else:\n-                res[pick.id] = False\n-        return res\n+                    pick.invoice_view_xmlid = 'account.invoice_form'\n \n-    _columns = {\n-        'invoice_id': fields.many2one(\n-            'account.invoice', 'Invoice', readonly=True),\n-        'invoice_view_xmlid': fields.function(\n-            _get_invoice_view_xmlid, type='char', string=\"Invoice View XMLID\",\n-            readonly=True),\n-    }\n+    invoice_id = fields.Many2one(comodel_name='account.invoice',\n+                                 string='Invoice', readonly=True)\n+    invoice_view_xmlid = fields.Char(compute='_get_invoice_view_xmlid',\n+                                     string=\"Invoice View XMLID\",\n+                                     readonly=True)\n \n \n-class account_invoice(orm.Model):\n+class AccountInvoice(models.Model):\n     _inherit = \"account.invoice\"\n \n-    _columns = {\n-        'picking_ids': fields.one2many(\n-            'stock.picking', 'invoice_id', 'Related Pickings', readonly=True,\n-            copy=False,\n-            help=\"Related pickings \"\n-            \"(only when the invoice has been generated from the picking).\"),\n-    }\n+    picking_ids = fields.One2many(\n+        comodel_name='stock.picking', inverse_name='invoice_id',\n+        string='Related Pickings', readonly=True,\n+        copy=False,\n+        help=\"Related pickings \"","path":"stock_picking_invoice_link/stock.py","position":93,"original_position":92,"commit_id":"15e764212626c193a846fef54f4dc18713f82f12","original_commit_id":"46372d0af1b451f811c212201f5c59cdea7d0466","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":"Well, I usually align the second line quote at the level of the first one, but PEP8 doesn't say anything about this, so what you want","created_at":"2015-07-10T15:24:58Z","updated_at":"2015-07-10T15:24:58Z","html_url":"https://github.com/OCA/stock-logistics-workflow/pull/129#discussion_r34365197","pull_request_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/129","_links":{"self":{"href":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/comments/34365197"},"html":{"href":"https://github.com/OCA/stock-logistics-workflow/pull/129#discussion_r34365197"},"pull_request":{"href":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/129"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/129","id":39690484,"html_url":"https://github.com/OCA/stock-logistics-workflow/pull/129","diff_url":"https://github.com/OCA/stock-logistics-workflow/pull/129.diff","patch_url":"https://github.com/OCA/stock-logistics-workflow/pull/129.patch","issue_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/issues/129","number":129,"state":"open","locked":false,"title":"Port stock_picking_invoice_link to the new API (and other improvements)","user":{"login":"tafaRU","id":3512779,"avatar_url":"https://avatars.githubusercontent.com/u/3512779?v=3","gravatar_id":"","url":"https://api.github.com/users/tafaRU","html_url":"https://github.com/tafaRU","followers_url":"https://api.github.com/users/tafaRU/followers","following_url":"https://api.github.com/users/tafaRU/following{/other_user}","gists_url":"https://api.github.com/users/tafaRU/gists{/gist_id}","starred_url":"https://api.github.com/users/tafaRU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tafaRU/subscriptions","organizations_url":"https://api.github.com/users/tafaRU/orgs","repos_url":"https://api.github.com/users/tafaRU/repos","events_url":"https://api.github.com/users/tafaRU/events{/privacy}","received_events_url":"https://api.github.com/users/tafaRU/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-10T14:41:51Z","updated_at":"2015-07-10T15:24:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac93d5f40a985b27ce77abc217d0c3b39e71c2be","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/129/commits","review_comments_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/129/comments","review_comment_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/issues/129/comments","statuses_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/statuses/15e764212626c193a846fef54f4dc18713f82f12","head":{"label":"tafaRU:8.0-stock_picking_invoice_link-imp","ref":"8.0-stock_picking_invoice_link-imp","sha":"15e764212626c193a846fef54f4dc18713f82f12","user":{"login":"tafaRU","id":3512779,"avatar_url":"https://avatars.githubusercontent.com/u/3512779?v=3","gravatar_id":"","url":"https://api.github.com/users/tafaRU","html_url":"https://github.com/tafaRU","followers_url":"https://api.github.com/users/tafaRU/followers","following_url":"https://api.github.com/users/tafaRU/following{/other_user}","gists_url":"https://api.github.com/users/tafaRU/gists{/gist_id}","starred_url":"https://api.github.com/users/tafaRU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tafaRU/subscriptions","organizations_url":"https://api.github.com/users/tafaRU/orgs","repos_url":"https://api.github.com/users/tafaRU/repos","events_url":"https://api.github.com/users/tafaRU/events{/privacy}","received_events_url":"https://api.github.com/users/tafaRU/received_events","type":"User","site_admin":false},"repo":{"id":21466304,"name":"stock-logistics-workflow","full_name":"tafaRU/stock-logistics-workflow","owner":{"login":"tafaRU","id":3512779,"avatar_url":"https://avatars.githubusercontent.com/u/3512779?v=3","gravatar_id":"","url":"https://api.github.com/users/tafaRU","html_url":"https://github.com/tafaRU","followers_url":"https://api.github.com/users/tafaRU/followers","following_url":"https://api.github.com/users/tafaRU/following{/other_user}","gists_url":"https://api.github.com/users/tafaRU/gists{/gist_id}","starred_url":"https://api.github.com/users/tafaRU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tafaRU/subscriptions","organizations_url":"https://api.github.com/users/tafaRU/orgs","repos_url":"https://api.github.com/users/tafaRU/repos","events_url":"https://api.github.com/users/tafaRU/events{/privacy}","received_events_url":"https://api.github.com/users/tafaRU/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tafaRU/stock-logistics-workflow","description":"","fork":true,"url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow","forks_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/forks","keys_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/teams","hooks_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/hooks","issue_events_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/issues/events{/number}","events_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/events","assignees_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/assignees{/user}","branches_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/branches{/branch}","tags_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/tags","blobs_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/statuses/{sha}","languages_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/languages","stargazers_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/stargazers","contributors_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/contributors","subscribers_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/subscribers","subscription_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/subscription","commits_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/contents/{+path}","compare_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/merges","archive_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/downloads","issues_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/issues{/number}","pulls_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/pulls{/number}","milestones_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/milestones{/number}","notifications_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/labels{/name}","releases_url":"https://api.github.com/repos/tafaRU/stock-logistics-workflow/releases{/id}","created_at":"2014-07-03T14:52:52Z","updated_at":"2014-07-01T04:40:18Z","pushed_at":"2015-07-10T15:19:50Z","git_url":"git://github.com/tafaRU/stock-logistics-workflow.git","ssh_url":"git@github.com:tafaRU/stock-logistics-workflow.git","clone_url":"https://github.com/tafaRU/stock-logistics-workflow.git","svn_url":"https://github.com/tafaRU/stock-logistics-workflow","homepage":null,"size":1330,"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":"master"}},"base":{"label":"OCA:8.0","ref":"8.0","sha":"d6b178ab0100b85658aaab08a3e32e1dfce6c04f","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":20891076,"name":"stock-logistics-workflow","full_name":"OCA/stock-logistics-workflow","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/stock-logistics-workflow","description":"Odoo Stock, Workflow and Organization","fork":false,"url":"https://api.github.com/repos/OCA/stock-logistics-workflow","forks_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/forks","keys_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/teams","hooks_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/hooks","issue_events_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/events","assignees_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/tags","blobs_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/languages","stargazers_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/stargazers","contributors_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/contributors","subscribers_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/subscribers","subscription_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/subscription","commits_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/merges","archive_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/downloads","issues_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/labels{/name}","releases_url":"https://api.github.com/repos/OCA/stock-logistics-workflow/releases{/id}","created_at":"2014-06-16T16:00:29Z","updated_at":"2015-07-07T07:59:31Z","pushed_at":"2015-07-10T15:19:50Z","git_url":"git://github.com/OCA/stock-logistics-workflow.git","ssh_url":"git@github.com:OCA/stock-logistics-workflow.git","clone_url":"https://github.com/OCA/stock-logistics-workflow.git","svn_url":"https://github.com/OCA/stock-logistics-workflow","homepage":"","size":2737,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":51,"mirror_url":null,"open_issues_count":31,"forks":51,"open_issues":31,"watchers":17,"default_branch":"8.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/129"},"html":{"href":"https://github.com/OCA/stock-logistics-workflow/pull/129"},"issue":{"href":"https://api.github.com/repos/OCA/stock-logistics-workflow/issues/129"},"comments":{"href":"https://api.github.com/repos/OCA/stock-logistics-workflow/issues/129/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/129/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/stock-logistics-workflow/pulls/129/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/stock-logistics-workflow/statuses/15e764212626c193a846fef54f4dc18713f82f12"}}}}