{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/account-analytic/pulls/comments/36849865","id":36849865,"diff_hunk":"@@ -0,0 +1,489 @@\n+# -*- coding: utf-8 -*-\n+##############################################################################\n+#\n+#    Author: Damien Crier\n+#    Copyright 2015 Camptocamp SA\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 time\n+from openerp.tests import common\n+\n+\n+class testAnalyticLine(common.TransactionCase):\n+\n+    def setUp(self):\n+        super(testAnalyticLine, self).setUp()\n+        self.agrolait = self.ref('account.analytic_agrolait')\n+        self.expense = self.ref('account.income_fx_expense')\n+\n+        self.account_analytic_line_obj = self.registry('account.analytic.line')\n+        self.account_analytic_account_obj = (\n+            self.registry('account.analytic.account')\n+        )\n+        self.res_currency_rate_model = self.registry('res.currency.rate')\n+        model_data_obj = self.registry(\"ir.model.data\")\n+        self.main_company = model_data_obj.get_object_reference(\n+            self.cr, self.uid, \"base\", \"main_company\")[1]\n+        self.partner_agrolait_id = model_data_obj.get_object_reference(\n+            self.cr, self.uid, \"base\", \"res_partner_2\")[1]\n+        self.currency_eur_id = model_data_obj.get_object_reference(\n+            self.cr, self.uid, \"base\", \"EUR\")[1]\n+        self.currency_usd_id = model_data_obj.get_object_reference(\n+            self.cr, self.uid, \"base\", \"USD\")[1]\n+        self.account_rcv_id = model_data_obj.get_object_reference(\n+            self.cr, self.uid, \"account\", \"a_recv\")[1]\n+\n+        self.account_fx_income_id = model_data_obj.get_object_reference(\n+            self.cr, self.uid, \"account\", \"income_fx_income\")[1]\n+        self.account_fx_expense_id = model_data_obj.get_object_reference(\n+            self.cr, self.uid, \"account\", \"income_fx_expense\")[1]\n+\n+        self.product_id = model_data_obj.get_object_reference(\n+            self.cr, self.uid, \"product\", \"product_product_4\")[1]\n+\n+        self.acs_model = self.registry('account.config.settings')\n+\n+        acs_ids = self.acs_model.search(\n+            self.cr, self.uid,\n+            [('company_id', '=', self.ref(\"base.main_company\"))]\n+            )\n+\n+        values = {'group_multi_currency': True,\n+                  'income_currency_exchange_account_id':\n+                  self.account_fx_income_id,\n+                  'expense_currency_exchange_account_id':\n+                  self.account_fx_expense_id}\n+\n+        if acs_ids:\n+            self.acs_model.write(self.cr, self.uid, acs_ids, values)\n+        else:\n+            default_vals = self.acs_model.default_get(self.cr, self.uid, [])\n+            default_vals.update(values)\n+            default_vals['date_stop'] = time.strftime('%Y-12-31')\n+            default_vals['date_start'] = time.strftime('%Y-%m-%d')\n+            default_vals['period'] = 'month'\n+            self.acs_model.create(self.cr, self.uid, default_vals)\n+\n+        self.aajournal = self.ref('account.analytic_journal_sale')\n+\n+    def test_analytic_lines(self):\n+        cr, uid = self.cr, self.uid\n+\n+        aal_id = self.account_analytic_line_obj.create(cr, uid, {\n+            'account_id': self.agrolait,\n+            'name': 'AGROLAIT',\n+            'journal_id': self.aajournal,\n+            'date': time.strftime('%Y-%m-%d'),\n+            'amount': 100,\n+            'general_account_id': self.account_rcv_id,\n+        })\n+        aal_brw = self.account_analytic_line_obj.browse(cr, uid, aal_id)\n+        self.assertEqual('EUR', aal_brw.aa_currency_id.name)\n+        self.assertEqual(100, aal_brw.aa_amount_currency)\n+        self.assertEqual(100, aal_brw.account_id.ca_invoiced)\n+        self.assertEqual(0, aal_brw.account_id.total_cost)\n+\n+    def test_analytic_lines2(self):","path":"analytic_multicurrency/tests/test_analytic_lines.py","position":100,"original_position":100,"commit_id":"5acd3b411ca8825e222b9861de8585c07fae9aa3","original_commit_id":"5acd3b411ca8825e222b9861de8585c07fae9aa3","user":{"login":"lmignon","id":544090,"avatar_url":"https://avatars.githubusercontent.com/u/544090?v=3","gravatar_id":"","url":"https://api.github.com/users/lmignon","html_url":"https://github.com/lmignon","followers_url":"https://api.github.com/users/lmignon/followers","following_url":"https://api.github.com/users/lmignon/following{/other_user}","gists_url":"https://api.github.com/users/lmignon/gists{/gist_id}","starred_url":"https://api.github.com/users/lmignon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmignon/subscriptions","organizations_url":"https://api.github.com/users/lmignon/orgs","repos_url":"https://api.github.com/users/lmignon/repos","events_url":"https://api.github.com/users/lmignon/events{/privacy}","received_events_url":"https://api.github.com/users/lmignon/received_events","type":"User","site_admin":false},"body":"PLZ put a description describing the test case.","created_at":"2015-08-12T11:39:04Z","updated_at":"2015-08-12T11:39:04Z","html_url":"https://github.com/OCA/account-analytic/pull/34#discussion_r36849865","pull_request_url":"https://api.github.com/repos/OCA/account-analytic/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/OCA/account-analytic/pulls/comments/36849865"},"html":{"href":"https://github.com/OCA/account-analytic/pull/34#discussion_r36849865"},"pull_request":{"href":"https://api.github.com/repos/OCA/account-analytic/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/account-analytic/pulls/34","id":37497258,"html_url":"https://github.com/OCA/account-analytic/pull/34","diff_url":"https://github.com/OCA/account-analytic/pull/34.diff","patch_url":"https://github.com/OCA/account-analytic/pull/34.patch","issue_url":"https://api.github.com/repos/OCA/account-analytic/issues/34","number":34,"state":"open","locked":false,"title":"[MIG] analytic_multicurrency","user":{"login":"charbeljc","id":11244811,"avatar_url":"https://avatars.githubusercontent.com/u/11244811?v=3","gravatar_id":"","url":"https://api.github.com/users/charbeljc","html_url":"https://github.com/charbeljc","followers_url":"https://api.github.com/users/charbeljc/followers","following_url":"https://api.github.com/users/charbeljc/following{/other_user}","gists_url":"https://api.github.com/users/charbeljc/gists{/gist_id}","starred_url":"https://api.github.com/users/charbeljc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charbeljc/subscriptions","organizations_url":"https://api.github.com/users/charbeljc/orgs","repos_url":"https://api.github.com/users/charbeljc/repos","events_url":"https://api.github.com/users/charbeljc/events{/privacy}","received_events_url":"https://api.github.com/users/charbeljc/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-11T19:02:43Z","updated_at":"2015-08-12T11:39:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f7f806d861f67f3659ccb6df52c3c4342f1392f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OCA/account-analytic/pulls/34/commits","review_comments_url":"https://api.github.com/repos/OCA/account-analytic/pulls/34/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/34/comments","statuses_url":"https://api.github.com/repos/OCA/account-analytic/statuses/5acd3b411ca8825e222b9861de8585c07fae9aa3","head":{"label":"charbeljc:8-0-analytic_multicurrency","ref":"8-0-analytic_multicurrency","sha":"5acd3b411ca8825e222b9861de8585c07fae9aa3","user":{"login":"charbeljc","id":11244811,"avatar_url":"https://avatars.githubusercontent.com/u/11244811?v=3","gravatar_id":"","url":"https://api.github.com/users/charbeljc","html_url":"https://github.com/charbeljc","followers_url":"https://api.github.com/users/charbeljc/followers","following_url":"https://api.github.com/users/charbeljc/following{/other_user}","gists_url":"https://api.github.com/users/charbeljc/gists{/gist_id}","starred_url":"https://api.github.com/users/charbeljc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charbeljc/subscriptions","organizations_url":"https://api.github.com/users/charbeljc/orgs","repos_url":"https://api.github.com/users/charbeljc/repos","events_url":"https://api.github.com/users/charbeljc/events{/privacy}","received_events_url":"https://api.github.com/users/charbeljc/received_events","type":"User","site_admin":false},"repo":{"id":35422275,"name":"account-analytic","full_name":"charbeljc/account-analytic","owner":{"login":"charbeljc","id":11244811,"avatar_url":"https://avatars.githubusercontent.com/u/11244811?v=3","gravatar_id":"","url":"https://api.github.com/users/charbeljc","html_url":"https://github.com/charbeljc","followers_url":"https://api.github.com/users/charbeljc/followers","following_url":"https://api.github.com/users/charbeljc/following{/other_user}","gists_url":"https://api.github.com/users/charbeljc/gists{/gist_id}","starred_url":"https://api.github.com/users/charbeljc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charbeljc/subscriptions","organizations_url":"https://api.github.com/users/charbeljc/orgs","repos_url":"https://api.github.com/users/charbeljc/repos","events_url":"https://api.github.com/users/charbeljc/events{/privacy}","received_events_url":"https://api.github.com/users/charbeljc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/charbeljc/account-analytic","description":"Odoo Account Analytic Related Addons","fork":true,"url":"https://api.github.com/repos/charbeljc/account-analytic","forks_url":"https://api.github.com/repos/charbeljc/account-analytic/forks","keys_url":"https://api.github.com/repos/charbeljc/account-analytic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/charbeljc/account-analytic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/charbeljc/account-analytic/teams","hooks_url":"https://api.github.com/repos/charbeljc/account-analytic/hooks","issue_events_url":"https://api.github.com/repos/charbeljc/account-analytic/issues/events{/number}","events_url":"https://api.github.com/repos/charbeljc/account-analytic/events","assignees_url":"https://api.github.com/repos/charbeljc/account-analytic/assignees{/user}","branches_url":"https://api.github.com/repos/charbeljc/account-analytic/branches{/branch}","tags_url":"https://api.github.com/repos/charbeljc/account-analytic/tags","blobs_url":"https://api.github.com/repos/charbeljc/account-analytic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/charbeljc/account-analytic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/charbeljc/account-analytic/git/refs{/sha}","trees_url":"https://api.github.com/repos/charbeljc/account-analytic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/charbeljc/account-analytic/statuses/{sha}","languages_url":"https://api.github.com/repos/charbeljc/account-analytic/languages","stargazers_url":"https://api.github.com/repos/charbeljc/account-analytic/stargazers","contributors_url":"https://api.github.com/repos/charbeljc/account-analytic/contributors","subscribers_url":"https://api.github.com/repos/charbeljc/account-analytic/subscribers","subscription_url":"https://api.github.com/repos/charbeljc/account-analytic/subscription","commits_url":"https://api.github.com/repos/charbeljc/account-analytic/commits{/sha}","git_commits_url":"https://api.github.com/repos/charbeljc/account-analytic/git/commits{/sha}","comments_url":"https://api.github.com/repos/charbeljc/account-analytic/comments{/number}","issue_comment_url":"https://api.github.com/repos/charbeljc/account-analytic/issues/comments{/number}","contents_url":"https://api.github.com/repos/charbeljc/account-analytic/contents/{+path}","compare_url":"https://api.github.com/repos/charbeljc/account-analytic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/charbeljc/account-analytic/merges","archive_url":"https://api.github.com/repos/charbeljc/account-analytic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/charbeljc/account-analytic/downloads","issues_url":"https://api.github.com/repos/charbeljc/account-analytic/issues{/number}","pulls_url":"https://api.github.com/repos/charbeljc/account-analytic/pulls{/number}","milestones_url":"https://api.github.com/repos/charbeljc/account-analytic/milestones{/number}","notifications_url":"https://api.github.com/repos/charbeljc/account-analytic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/charbeljc/account-analytic/labels{/name}","releases_url":"https://api.github.com/repos/charbeljc/account-analytic/releases{/id}","created_at":"2015-05-11T12:25:44Z","updated_at":"2015-05-11T12:25:44Z","pushed_at":"2015-08-12T09:44:19Z","git_url":"git://github.com/charbeljc/account-analytic.git","ssh_url":"git@github.com:charbeljc/account-analytic.git","clone_url":"https://github.com/charbeljc/account-analytic.git","svn_url":"https://github.com/charbeljc/account-analytic","homepage":"","size":330,"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":"5030a9fd879acf4f39b36d2ec1b279c58ca07932","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}","created_at":"2014-06-16T10:55:18Z","updated_at":"2015-06-07T08:25:06Z","pushed_at":"2015-08-12T09:44:19Z","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":701,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":9,"forks":24,"open_issues":9,"watchers":2,"default_branch":"8.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/account-analytic/pulls/34"},"html":{"href":"https://github.com/OCA/account-analytic/pull/34"},"issue":{"href":"https://api.github.com/repos/OCA/account-analytic/issues/34"},"comments":{"href":"https://api.github.com/repos/OCA/account-analytic/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/account-analytic/pulls/34/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/34/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/account-analytic/statuses/5acd3b411ca8825e222b9861de8585c07fae9aa3"}}}}