GitHub PullRequestReviewCommentEvent at 2014-11-17 09:13:58
Repository: odoo
Actor: qdp-odoo
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/odoo/odoo/pulls/comments/20423635","id":20423635,"diff_hunk":"@@ -757,11 +757,241 @@ def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None,\n             args.append(('partner_id', '=', partner[0]))\n         return super(account_move_line, self).search(cr, uid, args, offset, limit, order, context, count)\n \n-    def prepare_move_lines_for_reconciliation_widget(self, cr, uid, lines, target_currency=False, target_date=False, context=None):\n+    def get_data_for_manual_reconciliation(self, cr, uid, res_type, res_id=None, context=None):\n+        \"\"\" Returns the data required for the  manual reconciliation of a given partner/account.\n+            If no id is passed, returns data for all partners/accounts that can be reconciled.\n+            :param res_type: either 'partner' or 'account' \"\"\"\n+\n+        is_partner = res_type == 'partner'\n+        res_id_condition = res_id and 'AND r.id = '+str(res_id) or ''\n+        cr.execute(\n+            \"\"\" SELECT %s to_char(last_time_entries_checked, 'YYYY-MM-DD') AS last_time_entries_checked, account_id, account_name, account_code FROM (\n+                    SELECT %s last_time_entries_checked, account_id, account_name, account_code,\n+                        MAX(max_date) AS max_date,\n+                        SUM(debit) AS debit,\n+                        SUM(credit) AS credit\n+                    FROM (\n+                        -- The first subrequest is required in order for all lines in a partial reconciliations\n+                        -- to be considered as ONE debit OR ONE credit (since amount_residual isn't stored in the DB) \n+                        SELECT %s\n+                            a.id AS account_id,\n+                            a.name AS account_name,\n+                            a.code AS account_code,\n+                            MAX(l.create_date) AS max_date,\n+                            CASE WHEN SUM(l.debit) - SUM(l.credit) > 0 THEN SUM(l.debit) - SUM(l.credit) ELSE 0 END AS debit,\n+                            CASE WHEN SUM(l.credit) - SUM(l.debit) > 0 THEN SUM(l.credit) - SUM(l.debit) ELSE 0 END AS credit\n+                        FROM account_move_line l\n+                        RIGHT JOIN account_account a ON (a.id = l.account_id)\n+                        %s\n+                        WHERE a.reconcile IS TRUE\n+                        AND l.reconcile_id IS NULL\n+                        AND l.state <> 'draft'\n+                        %s\n+                        AND l.reconcile_partial_id IS NOT NULL\n+                        %s\n+                        GROUP BY %s a.id, l.reconcile_partial_id\n+\n+                        UNION\n+\n+                        SELECT %s\n+                            a.id AS account_id,\n+                            a.name AS account_name,\n+                            a.code AS account_code,\n+                            MAX(l.create_date) AS max_date,\n+                            SUM(l.debit) AS debit,\n+                            SUM(l.credit) AS credit\n+                        FROM account_move_line l\n+                        RIGHT JOIN account_account a ON (a.id = l.account_id)\n+                        %s\n+                        WHERE a.reconcile IS TRUE\n+                        AND l.reconcile_id IS NULL\n+                        AND l.state <> 'draft'\n+                        %s\n+                        AND l.reconcile_partial_id IS NULL\n+                        %s\n+                        GROUP BY %s a.id\n+                    ) AS s \n+                    GROUP BY %s last_time_entries_checked, account_id, account_name, account_code\n+                ) AS s\n+                WHERE debit > 0\n+                AND credit > 0\n+                AND (last_time_entries_checked IS NULL OR max_date > last_time_entries_checked)\n+                ORDER BY last_time_entries_checked\n+            \"\"\" % (\n+                is_partner and \"partner_id, partner_name,\" or \"\",\n+                is_partner and \"partner_id, partner_name,\" or \"\",\n+                is_partner and \"p.id AS partner_id, p.last_time_entries_checked, p.name AS partner_name,\" or \"a.last_time_entries_checked,\",\n+                is_partner and \"RIGHT JOIN res_partner p ON (l.partner_id = p.id)\" or \"\",\n+                not is_partner and \"AND a.type <> 'payable' AND a.type <> 'receivable'\" or \"\",\n+                res_id_condition,\n+                is_partner and \"l.partner_id, p.id,\" or \"\",\n+                is_partner and \"p.id AS partner_id, p.last_time_entries_checked, p.name AS partner_name,\" or \"a.last_time_entries_checked,\",\n+                is_partner and \"RIGHT JOIN res_partner p ON (l.partner_id = p.id)\" or \"\",\n+                not is_partner and \"AND a.type <> 'payable' AND a.type <> 'receivable'\" or \"\",\n+                res_id_condition,\n+                is_partner and \"l.partner_id, p.id,\" or \"\",\n+                is_partner and \"partner_id, partner_name,\" or \"\",\n+            ))\n+","path":"addons/account/account_move_line.py","position":89,"original_position":89,"commit_id":"84b4255909883b14af58f2d34c317c71a22b88d1","original_commit_id":"84b4255909883b14af58f2d34c317c71a22b88d1","user":{"login":"qdp-odoo","id":7628598,"avatar_url":"https://avatars.githubusercontent.com/u/7628598?v=3","gravatar_id":"","url":"https://api.github.com/users/qdp-odoo","html_url":"https://github.com/qdp-odoo","followers_url":"https://api.github.com/users/qdp-odoo/followers","following_url":"https://api.github.com/users/qdp-odoo/following{/other_user}","gists_url":"https://api.github.com/users/qdp-odoo/gists{/gist_id}","starred_url":"https://api.github.com/users/qdp-odoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qdp-odoo/subscriptions","organizations_url":"https://api.github.com/users/qdp-odoo/orgs","repos_url":"https://api.github.com/users/qdp-odoo/repos","events_url":"https://api.github.com/users/qdp-odoo/events{/privacy}","received_events_url":"https://api.github.com/users/qdp-odoo/received_events","type":"User","site_admin":false},"body":"do we need to have the partner name returned in the query? we don't have it for the account....\r\n\r\nalso, it would be better to have one variable \"checked_table\" to build the query on.\r\n```\r\nchecked_table = res_type == 'account' and 'a' or 'p'\r\nquery = \"\"\" SELECT ..... \"\"\" + checked_table + \"\"\".last_time_entrues_checked, .....\"\"\"\r\n```\r\n\r\nand i wonder if we couldn't just group by partner_id, account_id in all cases","created_at":"2014-11-17T09:13:58Z","updated_at":"2014-11-17T09:13:58Z","html_url":"https://github.com/odoo/odoo/pull/3345#discussion_r20423635","pull_request_url":"https://api.github.com/repos/odoo/odoo/pulls/3345","_links":{"self":{"href":"https://api.github.com/repos/odoo/odoo/pulls/comments/20423635"},"html":{"href":"https://github.com/odoo/odoo/pull/3345#discussion_r20423635"},"pull_request":{"href":"https://api.github.com/repos/odoo/odoo/pulls/3345"}}},"pull_request":{"url":"https://api.github.com/repos/odoo/odoo/pulls/3345","id":23453956,"html_url":"https://github.com/odoo/odoo/pull/3345","diff_url":"https://github.com/odoo/odoo/pull/3345.diff","patch_url":"https://github.com/odoo/odoo/pull/3345.patch","issue_url":"https://api.github.com/repos/odoo/odoo/issues/3345","number":3345,"state":"open","locked":false,"title":"Master reconciliation and statement import ama","user":{"login":"qdp-odoo","id":7628598,"avatar_url":"https://avatars.githubusercontent.com/u/7628598?v=3","gravatar_id":"","url":"https://api.github.com/users/qdp-odoo","html_url":"https://github.com/qdp-odoo","followers_url":"https://api.github.com/users/qdp-odoo/followers","following_url":"https://api.github.com/users/qdp-odoo/following{/other_user}","gists_url":"https://api.github.com/users/qdp-odoo/gists{/gist_id}","starred_url":"https://api.github.com/users/qdp-odoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qdp-odoo/subscriptions","organizations_url":"https://api.github.com/users/qdp-odoo/orgs","repos_url":"https://api.github.com/users/qdp-odoo/repos","events_url":"https://api.github.com/users/qdp-odoo/events{/privacy}","received_events_url":"https://api.github.com/users/qdp-odoo/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-10-28T12:58:26Z","updated_at":"2014-11-17T09:13:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc7c3a1e3a468268e4914a1bf11599ebfe6b6dd7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/odoo/odoo/pulls/3345/commits","review_comments_url":"https://api.github.com/repos/odoo/odoo/pulls/3345/comments","review_comment_url":"https://api.github.com/repos/odoo/odoo/pulls/comments/{number}","comments_url":"https://api.github.com/repos/odoo/odoo/issues/3345/comments","statuses_url":"https://api.github.com/repos/odoo/odoo/statuses/84b4255909883b14af58f2d34c317c71a22b88d1","head":{"label":"odoo-dev:master-reconciliation-and-statement-import-ama","ref":"master-reconciliation-and-statement-import-ama","sha":"84b4255909883b14af58f2d34c317c71a22b88d1","user":{"login":"odoo-dev","id":7466976,"avatar_url":"https://avatars.githubusercontent.com/u/7466976?v=3","gravatar_id":"","url":"https://api.github.com/users/odoo-dev","html_url":"https://github.com/odoo-dev","followers_url":"https://api.github.com/users/odoo-dev/followers","following_url":"https://api.github.com/users/odoo-dev/following{/other_user}","gists_url":"https://api.github.com/users/odoo-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/odoo-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odoo-dev/subscriptions","organizations_url":"https://api.github.com/users/odoo-dev/orgs","repos_url":"https://api.github.com/users/odoo-dev/repos","events_url":"https://api.github.com/users/odoo-dev/events{/privacy}","received_events_url":"https://api.github.com/users/odoo-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":19853934,"name":"odoo","full_name":"odoo-dev/odoo","owner":{"login":"odoo-dev","id":7466976,"avatar_url":"https://avatars.githubusercontent.com/u/7466976?v=3","gravatar_id":"","url":"https://api.github.com/users/odoo-dev","html_url":"https://github.com/odoo-dev","followers_url":"https://api.github.com/users/odoo-dev/followers","following_url":"https://api.github.com/users/odoo-dev/following{/other_user}","gists_url":"https://api.github.com/users/odoo-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/odoo-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odoo-dev/subscriptions","organizations_url":"https://api.github.com/users/odoo-dev/orgs","repos_url":"https://api.github.com/users/odoo-dev/repos","events_url":"https://api.github.com/users/odoo-dev/events{/privacy}","received_events_url":"https://api.github.com/users/odoo-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odoo-dev/odoo","description":"RD Dev Repository","fork":true,"url":"https://api.github.com/repos/odoo-dev/odoo","forks_url":"https://api.github.com/repos/odoo-dev/odoo/forks","keys_url":"https://api.github.com/repos/odoo-dev/odoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odoo-dev/odoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odoo-dev/odoo/teams","hooks_url":"https://api.github.com/repos/odoo-dev/odoo/hooks","issue_events_url":"https://api.github.com/repos/odoo-dev/odoo/issues/events{/number}","events_url":"https://api.github.com/repos/odoo-dev/odoo/events","assignees_url":"https://api.github.com/repos/odoo-dev/odoo/assignees{/user}","branches_url":"https://api.github.com/repos/odoo-dev/odoo/branches{/branch}","tags_url":"https://api.github.com/repos/odoo-dev/odoo/tags","blobs_url":"https://api.github.com/repos/odoo-dev/odoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odoo-dev/odoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odoo-dev/odoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/odoo-dev/odoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odoo-dev/odoo/statuses/{sha}","languages_url":"https://api.github.com/repos/odoo-dev/odoo/languages","stargazers_url":"https://api.github.com/repos/odoo-dev/odoo/stargazers","contributors_url":"https://api.github.com/repos/odoo-dev/odoo/contributors","subscribers_url":"https://api.github.com/repos/odoo-dev/odoo/subscribers","subscription_url":"https://api.github.com/repos/odoo-dev/odoo/subscription","commits_url":"https://api.github.com/repos/odoo-dev/odoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/odoo-dev/odoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/odoo-dev/odoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/odoo-dev/odoo/issues/comments/{number}","contents_url":"https://api.github.com/repos/odoo-dev/odoo/contents/{+path}","compare_url":"https://api.github.com/repos/odoo-dev/odoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odoo-dev/odoo/merges","archive_url":"https://api.github.com/repos/odoo-dev/odoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odoo-dev/odoo/downloads","issues_url":"https://api.github.com/repos/odoo-dev/odoo/issues{/number}","pulls_url":"https://api.github.com/repos/odoo-dev/odoo/pulls{/number}","milestones_url":"https://api.github.com/repos/odoo-dev/odoo/milestones{/number}","notifications_url":"https://api.github.com/repos/odoo-dev/odoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odoo-dev/odoo/labels{/name}","releases_url":"https://api.github.com/repos/odoo-dev/odoo/releases{/id}","created_at":"2014-05-16T11:16:19Z","updated_at":"2014-10-18T14:37:38Z","pushed_at":"2014-11-17T09:13:44Z","git_url":"git://github.com/odoo-dev/odoo.git","ssh_url":"git@github.com:odoo-dev/odoo.git","clone_url":"https://github.com/odoo-dev/odoo.git","svn_url":"https://github.com/odoo-dev/odoo","homepage":"https://www.odoo.com","size":993038,"stargazers_count":34,"watchers_count":34,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":10,"forks":12,"open_issues":10,"watchers":34,"default_branch":"master"}},"base":{"label":"odoo:master","ref":"master","sha":"17937e7e9276d25a9900fb310f5f0be1928cabc7","user":{"login":"odoo","id":6368483,"avatar_url":"https://avatars.githubusercontent.com/u/6368483?v=3","gravatar_id":"","url":"https://api.github.com/users/odoo","html_url":"https://github.com/odoo","followers_url":"https://api.github.com/users/odoo/followers","following_url":"https://api.github.com/users/odoo/following{/other_user}","gists_url":"https://api.github.com/users/odoo/gists{/gist_id}","starred_url":"https://api.github.com/users/odoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odoo/subscriptions","organizations_url":"https://api.github.com/users/odoo/orgs","repos_url":"https://api.github.com/users/odoo/repos","events_url":"https://api.github.com/users/odoo/events{/privacy}","received_events_url":"https://api.github.com/users/odoo/received_events","type":"Organization","site_admin":false},"repo":{"id":19745004,"name":"odoo","full_name":"odoo/odoo","owner":{"login":"odoo","id":6368483,"avatar_url":"https://avatars.githubusercontent.com/u/6368483?v=3","gravatar_id":"","url":"https://api.github.com/users/odoo","html_url":"https://github.com/odoo","followers_url":"https://api.github.com/users/odoo/followers","following_url":"https://api.github.com/users/odoo/following{/other_user}","gists_url":"https://api.github.com/users/odoo/gists{/gist_id}","starred_url":"https://api.github.com/users/odoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odoo/subscriptions","organizations_url":"https://api.github.com/users/odoo/orgs","repos_url":"https://api.github.com/users/odoo/repos","events_url":"https://api.github.com/users/odoo/events{/privacy}","received_events_url":"https://api.github.com/users/odoo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odoo/odoo","description":"Odoo (formerly OpenERP). Open Source Apps To Grow Your Business.","fork":false,"url":"https://api.github.com/repos/odoo/odoo","forks_url":"https://api.github.com/repos/odoo/odoo/forks","keys_url":"https://api.github.com/repos/odoo/odoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odoo/odoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odoo/odoo/teams","hooks_url":"https://api.github.com/repos/odoo/odoo/hooks","issue_events_url":"https://api.github.com/repos/odoo/odoo/issues/events{/number}","events_url":"https://api.github.com/repos/odoo/odoo/events","assignees_url":"https://api.github.com/repos/odoo/odoo/assignees{/user}","branches_url":"https://api.github.com/repos/odoo/odoo/branches{/branch}","tags_url":"https://api.github.com/repos/odoo/odoo/tags","blobs_url":"https://api.github.com/repos/odoo/odoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odoo/odoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odoo/odoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/odoo/odoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odoo/odoo/statuses/{sha}","languages_url":"https://api.github.com/repos/odoo/odoo/languages","stargazers_url":"https://api.github.com/repos/odoo/odoo/stargazers","contributors_url":"https://api.github.com/repos/odoo/odoo/contributors","subscribers_url":"https://api.github.com/repos/odoo/odoo/subscribers","subscription_url":"https://api.github.com/repos/odoo/odoo/subscription","commits_url":"https://api.github.com/repos/odoo/odoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/odoo/odoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/odoo/odoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/odoo/odoo/issues/comments/{number}","contents_url":"https://api.github.com/repos/odoo/odoo/contents/{+path}","compare_url":"https://api.github.com/repos/odoo/odoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odoo/odoo/merges","archive_url":"https://api.github.com/repos/odoo/odoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odoo/odoo/downloads","issues_url":"https://api.github.com/repos/odoo/odoo/issues{/number}","pulls_url":"https://api.github.com/repos/odoo/odoo/pulls{/number}","milestones_url":"https://api.github.com/repos/odoo/odoo/milestones{/number}","notifications_url":"https://api.github.com/repos/odoo/odoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odoo/odoo/labels{/name}","releases_url":"https://api.github.com/repos/odoo/odoo/releases{/id}","created_at":"2014-05-13T15:38:58Z","updated_at":"2014-11-16T22:36:40Z","pushed_at":"2014-11-17T09:06:23Z","git_url":"git://github.com/odoo/odoo.git","ssh_url":"git@github.com:odoo/odoo.git","clone_url":"https://github.com/odoo/odoo.git","svn_url":"https://github.com/odoo/odoo","homepage":"https://www.odoo.com","size":954565,"stargazers_count":1561,"watchers_count":1561,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1196,"mirror_url":null,"open_issues_count":1390,"forks":1196,"open_issues":1390,"watchers":1561,"default_branch":"8.0"}},"_links":{"self":{"href":"https://api.github.com/repos/odoo/odoo/pulls/3345"},"html":{"href":"https://github.com/odoo/odoo/pull/3345"},"issue":{"href":"https://api.github.com/repos/odoo/odoo/issues/3345"},"comments":{"href":"https://api.github.com/repos/odoo/odoo/issues/3345/comments"},"review_comments":{"href":"https://api.github.com/repos/odoo/odoo/pulls/3345/comments"},"review_comment":{"href":"https://api.github.com/repos/odoo/odoo/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/odoo/odoo/pulls/3345/commits"},"statuses":{"href":"https://api.github.com/repos/odoo/odoo/statuses/84b4255909883b14af58f2d34c317c71a22b88d1"}}}}