{"action":"created","comment":{"url":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/comments/34465167","id":34465167,"diff_hunk":"@@ -33,26 +33,24 @@ class invoice(orm.Model):\n     '''\r\n     _inherit = 'account.invoice'\r\n \r\n-    def cancel_payment_lines(self, cr, uid, ids, context=None):\r\n+    @api.multi\r\n+    def cancel_payment_lines(self):\r\n         ''' This function simply find related payment lines and move them\r\n             in a new payment order.\r\n         '''\r\n-        mov_line_obj = self.pool.get('account.move.line')\r\n-        pay_line_obj = self.pool.get('payment.line')\r\n-        pay_order_obj = self.pool.get('payment.order')\r\n-\r\n-        active_ids = context.get('active_ids')\r\n-        move_ids = [inv.move_id.id for inv in self.browse(cr, uid,\r\n-                                                          active_ids, context)]\r\n-        move_line_ids = mov_line_obj.search(\r\n-            cr, uid, [('move_id', 'in', move_ids)], context=context)\r\n-\r\n-        pay_line_ids = pay_line_obj.search(\r\n-            cr, uid, [('move_line_id', 'in', move_line_ids)], context=context)\r\n+        mov_line_obj = self.env['account.move.line']\r\n+        pay_line_obj = self.env['payment.line']\r\n+        pay_order_obj = self.env['payment.order']\r\n+        active_ids = self.env.context.get('active_ids')\r\n+        move_ids = [inv.move_id.id for inv in self.browse(active_ids)]\r\n+        move_ids = [inv.move_id.id for inv in self.browse(active_ids)]\r\n+        move_line_ids = mov_line_obj.search([('move_id', 'in', move_ids)])\r\n+\r\n+        pay_line_ids = pay_line_obj.search([('move_line_id', 'in', move_line_ids)])\r\n         if not pay_line_ids:\r\n-            raise orm.except_orm('RuntimeError', _('No payment line found !'))\r\n+            raise exceptions.Warning(_('No payment line found !'))\r\n \r\n-        old_pay_order = pay_line_obj.browse(cr, uid, pay_line_ids[0]).order_id\r\n+        old_pay_order = pay_line_obj.browse(pay_line_ids[0]).order_id\r","path":"l10n_ch_lsv_dd/model/invoice.py","position":52,"original_position":52,"commit_id":"ee9fa74cc14452f0d4e07f09c0093b25c36d2e5b","original_commit_id":"ee9fa74cc14452f0d4e07f09c0093b25c36d2e5b","user":{"login":"steveferry","id":6231186,"avatar_url":"https://avatars.githubusercontent.com/u/6231186?v=3","gravatar_id":"","url":"https://api.github.com/users/steveferry","html_url":"https://github.com/steveferry","followers_url":"https://api.github.com/users/steveferry/followers","following_url":"https://api.github.com/users/steveferry/following{/other_user}","gists_url":"https://api.github.com/users/steveferry/gists{/gist_id}","starred_url":"https://api.github.com/users/steveferry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveferry/subscriptions","organizations_url":"https://api.github.com/users/steveferry/orgs","repos_url":"https://api.github.com/users/steveferry/repos","events_url":"https://api.github.com/users/steveferry/events{/privacy}","received_events_url":"https://api.github.com/users/steveferry/received_events","type":"User","site_admin":false},"body":"`pay_line_ids` is a RecordSet. So you don't need to browse but access directly to `order_id` on the first Record","created_at":"2015-07-13T14:01:53Z","updated_at":"2015-07-13T14:01:53Z","html_url":"https://github.com/steveferry/l10n-switzerland/pull/1#discussion_r34465167","pull_request_url":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/comments/34465167"},"html":{"href":"https://github.com/steveferry/l10n-switzerland/pull/1#discussion_r34465167"},"pull_request":{"href":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/1","id":39573512,"html_url":"https://github.com/steveferry/l10n-switzerland/pull/1","diff_url":"https://github.com/steveferry/l10n-switzerland/pull/1.diff","patch_url":"https://github.com/steveferry/l10n-switzerland/pull/1.patch","issue_url":"https://api.github.com/repos/steveferry/l10n-switzerland/issues/1","number":1,"state":"open","locked":false,"title":"Port statement import","user":{"login":"ndtran","id":3668383,"avatar_url":"https://avatars.githubusercontent.com/u/3668383?v=3","gravatar_id":"","url":"https://api.github.com/users/ndtran","html_url":"https://github.com/ndtran","followers_url":"https://api.github.com/users/ndtran/followers","following_url":"https://api.github.com/users/ndtran/following{/other_user}","gists_url":"https://api.github.com/users/ndtran/gists{/gist_id}","starred_url":"https://api.github.com/users/ndtran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndtran/subscriptions","organizations_url":"https://api.github.com/users/ndtran/orgs","repos_url":"https://api.github.com/users/ndtran/repos","events_url":"https://api.github.com/users/ndtran/events{/privacy}","received_events_url":"https://api.github.com/users/ndtran/received_events","type":"User","site_admin":false},"body":"pull requests of module l10n_ch_lsv_dd","created_at":"2015-07-09T11:35:56Z","updated_at":"2015-07-13T14:01:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6702a7e4f8674a01ad4e38f71c61b68fc6f20a11","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/1/commits","review_comments_url":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/1/comments","review_comment_url":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/comments{/number}","comments_url":"https://api.github.com/repos/steveferry/l10n-switzerland/issues/1/comments","statuses_url":"https://api.github.com/repos/steveferry/l10n-switzerland/statuses/ee9fa74cc14452f0d4e07f09c0093b25c36d2e5b","head":{"label":"ndtran:port-statement-import","ref":"port-statement-import","sha":"ee9fa74cc14452f0d4e07f09c0093b25c36d2e5b","user":{"login":"ndtran","id":3668383,"avatar_url":"https://avatars.githubusercontent.com/u/3668383?v=3","gravatar_id":"","url":"https://api.github.com/users/ndtran","html_url":"https://github.com/ndtran","followers_url":"https://api.github.com/users/ndtran/followers","following_url":"https://api.github.com/users/ndtran/following{/other_user}","gists_url":"https://api.github.com/users/ndtran/gists{/gist_id}","starred_url":"https://api.github.com/users/ndtran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndtran/subscriptions","organizations_url":"https://api.github.com/users/ndtran/orgs","repos_url":"https://api.github.com/users/ndtran/repos","events_url":"https://api.github.com/users/ndtran/events{/privacy}","received_events_url":"https://api.github.com/users/ndtran/received_events","type":"User","site_admin":false},"repo":{"id":38607055,"name":"l10n-switzerland","full_name":"ndtran/l10n-switzerland","owner":{"login":"ndtran","id":3668383,"avatar_url":"https://avatars.githubusercontent.com/u/3668383?v=3","gravatar_id":"","url":"https://api.github.com/users/ndtran","html_url":"https://github.com/ndtran","followers_url":"https://api.github.com/users/ndtran/followers","following_url":"https://api.github.com/users/ndtran/following{/other_user}","gists_url":"https://api.github.com/users/ndtran/gists{/gist_id}","starred_url":"https://api.github.com/users/ndtran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndtran/subscriptions","organizations_url":"https://api.github.com/users/ndtran/orgs","repos_url":"https://api.github.com/users/ndtran/repos","events_url":"https://api.github.com/users/ndtran/events{/privacy}","received_events_url":"https://api.github.com/users/ndtran/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ndtran/l10n-switzerland","description":"","fork":true,"url":"https://api.github.com/repos/ndtran/l10n-switzerland","forks_url":"https://api.github.com/repos/ndtran/l10n-switzerland/forks","keys_url":"https://api.github.com/repos/ndtran/l10n-switzerland/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ndtran/l10n-switzerland/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ndtran/l10n-switzerland/teams","hooks_url":"https://api.github.com/repos/ndtran/l10n-switzerland/hooks","issue_events_url":"https://api.github.com/repos/ndtran/l10n-switzerland/issues/events{/number}","events_url":"https://api.github.com/repos/ndtran/l10n-switzerland/events","assignees_url":"https://api.github.com/repos/ndtran/l10n-switzerland/assignees{/user}","branches_url":"https://api.github.com/repos/ndtran/l10n-switzerland/branches{/branch}","tags_url":"https://api.github.com/repos/ndtran/l10n-switzerland/tags","blobs_url":"https://api.github.com/repos/ndtran/l10n-switzerland/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ndtran/l10n-switzerland/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ndtran/l10n-switzerland/git/refs{/sha}","trees_url":"https://api.github.com/repos/ndtran/l10n-switzerland/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ndtran/l10n-switzerland/statuses/{sha}","languages_url":"https://api.github.com/repos/ndtran/l10n-switzerland/languages","stargazers_url":"https://api.github.com/repos/ndtran/l10n-switzerland/stargazers","contributors_url":"https://api.github.com/repos/ndtran/l10n-switzerland/contributors","subscribers_url":"https://api.github.com/repos/ndtran/l10n-switzerland/subscribers","subscription_url":"https://api.github.com/repos/ndtran/l10n-switzerland/subscription","commits_url":"https://api.github.com/repos/ndtran/l10n-switzerland/commits{/sha}","git_commits_url":"https://api.github.com/repos/ndtran/l10n-switzerland/git/commits{/sha}","comments_url":"https://api.github.com/repos/ndtran/l10n-switzerland/comments{/number}","issue_comment_url":"https://api.github.com/repos/ndtran/l10n-switzerland/issues/comments{/number}","contents_url":"https://api.github.com/repos/ndtran/l10n-switzerland/contents/{+path}","compare_url":"https://api.github.com/repos/ndtran/l10n-switzerland/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ndtran/l10n-switzerland/merges","archive_url":"https://api.github.com/repos/ndtran/l10n-switzerland/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ndtran/l10n-switzerland/downloads","issues_url":"https://api.github.com/repos/ndtran/l10n-switzerland/issues{/number}","pulls_url":"https://api.github.com/repos/ndtran/l10n-switzerland/pulls{/number}","milestones_url":"https://api.github.com/repos/ndtran/l10n-switzerland/milestones{/number}","notifications_url":"https://api.github.com/repos/ndtran/l10n-switzerland/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ndtran/l10n-switzerland/labels{/name}","releases_url":"https://api.github.com/repos/ndtran/l10n-switzerland/releases{/id}","created_at":"2015-07-06T08:37:00Z","updated_at":"2015-07-06T08:37:01Z","pushed_at":"2015-07-13T12:09:29Z","git_url":"git://github.com/ndtran/l10n-switzerland.git","ssh_url":"git@github.com:ndtran/l10n-switzerland.git","clone_url":"https://github.com/ndtran/l10n-switzerland.git","svn_url":"https://github.com/ndtran/l10n-switzerland","homepage":null,"size":5207,"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":"7.0"}},"base":{"label":"steveferry:port-statement-import","ref":"port-statement-import","sha":"6174468e0f66091d96490243a1bc03fa92ab6fea","user":{"login":"steveferry","id":6231186,"avatar_url":"https://avatars.githubusercontent.com/u/6231186?v=3","gravatar_id":"","url":"https://api.github.com/users/steveferry","html_url":"https://github.com/steveferry","followers_url":"https://api.github.com/users/steveferry/followers","following_url":"https://api.github.com/users/steveferry/following{/other_user}","gists_url":"https://api.github.com/users/steveferry/gists{/gist_id}","starred_url":"https://api.github.com/users/steveferry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveferry/subscriptions","organizations_url":"https://api.github.com/users/steveferry/orgs","repos_url":"https://api.github.com/users/steveferry/repos","events_url":"https://api.github.com/users/steveferry/events{/privacy}","received_events_url":"https://api.github.com/users/steveferry/received_events","type":"User","site_admin":false},"repo":{"id":36801310,"name":"l10n-switzerland","full_name":"steveferry/l10n-switzerland","owner":{"login":"steveferry","id":6231186,"avatar_url":"https://avatars.githubusercontent.com/u/6231186?v=3","gravatar_id":"","url":"https://api.github.com/users/steveferry","html_url":"https://github.com/steveferry","followers_url":"https://api.github.com/users/steveferry/followers","following_url":"https://api.github.com/users/steveferry/following{/other_user}","gists_url":"https://api.github.com/users/steveferry/gists{/gist_id}","starred_url":"https://api.github.com/users/steveferry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveferry/subscriptions","organizations_url":"https://api.github.com/users/steveferry/orgs","repos_url":"https://api.github.com/users/steveferry/repos","events_url":"https://api.github.com/users/steveferry/events{/privacy}","received_events_url":"https://api.github.com/users/steveferry/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/steveferry/l10n-switzerland","description":"","fork":true,"url":"https://api.github.com/repos/steveferry/l10n-switzerland","forks_url":"https://api.github.com/repos/steveferry/l10n-switzerland/forks","keys_url":"https://api.github.com/repos/steveferry/l10n-switzerland/keys{/key_id}","collaborators_url":"https://api.github.com/repos/steveferry/l10n-switzerland/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/steveferry/l10n-switzerland/teams","hooks_url":"https://api.github.com/repos/steveferry/l10n-switzerland/hooks","issue_events_url":"https://api.github.com/repos/steveferry/l10n-switzerland/issues/events{/number}","events_url":"https://api.github.com/repos/steveferry/l10n-switzerland/events","assignees_url":"https://api.github.com/repos/steveferry/l10n-switzerland/assignees{/user}","branches_url":"https://api.github.com/repos/steveferry/l10n-switzerland/branches{/branch}","tags_url":"https://api.github.com/repos/steveferry/l10n-switzerland/tags","blobs_url":"https://api.github.com/repos/steveferry/l10n-switzerland/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/steveferry/l10n-switzerland/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/steveferry/l10n-switzerland/git/refs{/sha}","trees_url":"https://api.github.com/repos/steveferry/l10n-switzerland/git/trees{/sha}","statuses_url":"https://api.github.com/repos/steveferry/l10n-switzerland/statuses/{sha}","languages_url":"https://api.github.com/repos/steveferry/l10n-switzerland/languages","stargazers_url":"https://api.github.com/repos/steveferry/l10n-switzerland/stargazers","contributors_url":"https://api.github.com/repos/steveferry/l10n-switzerland/contributors","subscribers_url":"https://api.github.com/repos/steveferry/l10n-switzerland/subscribers","subscription_url":"https://api.github.com/repos/steveferry/l10n-switzerland/subscription","commits_url":"https://api.github.com/repos/steveferry/l10n-switzerland/commits{/sha}","git_commits_url":"https://api.github.com/repos/steveferry/l10n-switzerland/git/commits{/sha}","comments_url":"https://api.github.com/repos/steveferry/l10n-switzerland/comments{/number}","issue_comment_url":"https://api.github.com/repos/steveferry/l10n-switzerland/issues/comments{/number}","contents_url":"https://api.github.com/repos/steveferry/l10n-switzerland/contents/{+path}","compare_url":"https://api.github.com/repos/steveferry/l10n-switzerland/compare/{base}...{head}","merges_url":"https://api.github.com/repos/steveferry/l10n-switzerland/merges","archive_url":"https://api.github.com/repos/steveferry/l10n-switzerland/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/steveferry/l10n-switzerland/downloads","issues_url":"https://api.github.com/repos/steveferry/l10n-switzerland/issues{/number}","pulls_url":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls{/number}","milestones_url":"https://api.github.com/repos/steveferry/l10n-switzerland/milestones{/number}","notifications_url":"https://api.github.com/repos/steveferry/l10n-switzerland/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/steveferry/l10n-switzerland/labels{/name}","releases_url":"https://api.github.com/repos/steveferry/l10n-switzerland/releases{/id}","created_at":"2015-06-03T12:11:32Z","updated_at":"2015-06-03T12:11:32Z","pushed_at":"2015-07-13T12:09:30Z","git_url":"git://github.com/steveferry/l10n-switzerland.git","ssh_url":"git@github.com:steveferry/l10n-switzerland.git","clone_url":"https://github.com/steveferry/l10n-switzerland.git","svn_url":"https://github.com/steveferry/l10n-switzerland","homepage":null,"size":5290,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"7.0"}},"_links":{"self":{"href":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/1"},"html":{"href":"https://github.com/steveferry/l10n-switzerland/pull/1"},"issue":{"href":"https://api.github.com/repos/steveferry/l10n-switzerland/issues/1"},"comments":{"href":"https://api.github.com/repos/steveferry/l10n-switzerland/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/steveferry/l10n-switzerland/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/steveferry/l10n-switzerland/statuses/ee9fa74cc14452f0d4e07f09c0093b25c36d2e5b"}}}}