{"action":"created","comment":{"url":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/comments/69706678","id":69706678,"diff_hunk":"@@ -43,72 +43,48 @@ class AccountFinancialReport(models.Model):\n         'Periods', help='All periods in the fiscal year if empty')\n \n     @api.multi\n-    def copy(self, cr, uid, ids, default=None, context=None):\n-        context = context and dict(context) or {}\n-        previous_name = self.browse(cr, uid, ids, context=context).name\n-        new_name = _('Copy of %s') % previous_name\n-        lst = self.search(cr, uid, [('name', 'like', new_name)],\n-                          context=context)\n+    def copy(self, default=None):\n+        '''Duplicate a record and changes its name to make it unique'''\n+        default = dict(default or {})\n+        new_name = _('Copy of %s') % self.name\n+        lst = self.search([('name', 'like', new_name)])\n         if lst:\n-            new_name = '%s (%s)' % (new_name, len(lst) + 1)\n+            new_name = u'%s (%s)' % (new_name, len(lst) + 1)\n         default['name'] = new_name\n-        return super(AccountFinancialReport, self).copy(cr, uid, ids,\n-                                                        default=default,\n-                                                        context=context)\n+        return super(AccountFinancialReport, self).copy(default=default)\n \n-    def onchange_inf_type(self, cr, uid, ids, inf_type, context=None):\n-        context = context and dict(context) or {}\n-        res = {'value': {}}\n+    @api.onchange('inf_type')\n+    def onchange_inf_type(self):\n+        '''When report type changes boolean field analytic ledger changes\n+        if applies'''\n+        for brw in self:\n+            if brw.inf_type != 'BS':\n+                brw.update({'analytic_ledger': False})\n \n-        if inf_type != 'BS':\n-            res['value'].update({'analytic_ledger': False})\n+    @api.onchange('columns', 'fiscalyear_id')\n+    def onchange_columns(self):\n+        for brw in self:\n+            values = {}\n+            if brw.columns != 'four':\n+                values.update({'analytic_ledger': False})\n \n-        return res\n+            values.update({'period_ids': [(6, False, {})]})\n \n-    def onchange_columns(self, cr, uid, ids, columns,\n-                         fiscalyear_id, period_ids, context=None):\n-        context = context and dict(context) or {}\n-        res = {'value': {}}\n+            brw.update(values)\n \n-        if columns != 'four':\n-            res['value'].update({'analytic_ledger': False})\n-        if columns != 'currency':\n-            res['value'].update({'analytic_ledger': True})\n-        if columns in ('qtr', 'thirteen'):\n-            p_obj = self.pool.get(\"account.period\")\n-            period_ids = p_obj.search(cr, uid,\n-                                      [('fiscalyear_id', '=', fiscalyear_id),\n-                                       ('special', '=', False)],\n-                                      context=context)\n-            res['value'].update({'period_ids': period_ids})\n-        else:\n-            res['value'].update({'period_ids': []})\n-        return res\n+    @api.onchange('analytic_ledger')\n+    def onchange_analytic_ledger(self):\n+        for brw in self:\n+            if brw.analytic_ledger:\n+                brw.update({'currency_id': self.company_id.currency_id.id})\n \n-    def onchange_analytic_ledger(\n-            self, cr, uid, ids, company_id, analytic_ledger, context=None):\n-        context = context and dict(context) or {}\n-        context['company_id'] = company_id\n-        res = {'value': {}}\n-        cur_id = self.pool.get('res.company').browse(\n-            cr, uid, company_id, context=context).currency_id.id\n-        res['value'].update({'currency_id': cur_id})\n-        return res\n-\n-    def onchange_company_id(self, cr, uid, ids, company_id, context=None):\n-        context = context and dict(context) or {}\n-        context['company_id'] = company_id\n-        res = {'value': {}}\n-\n-        if not company_id:\n-            return res\n-\n-        cur_id = self.pool.get('res.company').browse(\n-            cr, uid, company_id, context=context).currency_id.id\n-        fy_id = self.pool.get('account.fiscalyear').find(\n-            cr, uid, context=context)\n-        res['value'].update({'fiscalyear_id': fy_id})\n-        res['value'].update({'currency_id': cur_id})\n-        res['value'].update({'account_ids': []})\n-        res['value'].update({'period_ids': []})\n-        return res\n+    @api.onchange('company_id')\n+    def onchange_company_id(self):","path":"account_financial_report/model/account_financial_report.py","position":101,"original_position":101,"commit_id":"7a6f7576441f63695f91eb5ef00070f45f00fdb8","original_commit_id":"7a6f7576441f63695f91eb5ef00070f45f00fdb8","user":{"login":"nhomar","id":338634,"avatar_url":"https://avatars.githubusercontent.com/u/338634?v=3","gravatar_id":"","url":"https://api.github.com/users/nhomar","html_url":"https://github.com/nhomar","followers_url":"https://api.github.com/users/nhomar/followers","following_url":"https://api.github.com/users/nhomar/following{/other_user}","gists_url":"https://api.github.com/users/nhomar/gists{/gist_id}","starred_url":"https://api.github.com/users/nhomar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhomar/subscriptions","organizations_url":"https://api.github.com/users/nhomar/orgs","repos_url":"https://api.github.com/users/nhomar/repos","events_url":"https://api.github.com/users/nhomar/events{/privacy}","received_events_url":"https://api.github.com/users/nhomar/received_events","type":"User","site_admin":false},"body":"same here","created_at":"2016-07-06T10:19:05Z","updated_at":"2016-07-06T10:19:05Z","html_url":"https://github.com/Vauxoo/odoo-afr/pull/38#discussion_r69706678","pull_request_url":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/comments/69706678"},"html":{"href":"https://github.com/Vauxoo/odoo-afr/pull/38#discussion_r69706678"},"pull_request":{"href":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/38","id":76408924,"html_url":"https://github.com/Vauxoo/odoo-afr/pull/38","diff_url":"https://github.com/Vauxoo/odoo-afr/pull/38.diff","patch_url":"https://github.com/Vauxoo/odoo-afr/pull/38.patch","issue_url":"https://api.github.com/repos/Vauxoo/odoo-afr/issues/38","number":38,"state":"open","locked":false,"title":"[IMP] Increasing Coverage & Migrating to New api AFR","user":{"login":"hbto","id":7598010,"avatar_url":"https://avatars.githubusercontent.com/u/7598010?v=3","gravatar_id":"","url":"https://api.github.com/users/hbto","html_url":"https://github.com/hbto","followers_url":"https://api.github.com/users/hbto/followers","following_url":"https://api.github.com/users/hbto/following{/other_user}","gists_url":"https://api.github.com/users/hbto/gists{/gist_id}","starred_url":"https://api.github.com/users/hbto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hbto/subscriptions","organizations_url":"https://api.github.com/users/hbto/orgs","repos_url":"https://api.github.com/users/hbto/repos","events_url":"https://api.github.com/users/hbto/events{/privacy}","received_events_url":"https://api.github.com/users/hbto/received_events","type":"User","site_admin":false},"body":"[IMP] Increasing Coverage & Migrating to New api AFR","created_at":"2016-07-06T10:16:06Z","updated_at":"2016-07-06T10:19:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3cf9de3ac90aea6b3fdc136bffb8f3d506b205a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/38/commits","review_comments_url":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/38/comments","review_comment_url":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Vauxoo/odoo-afr/issues/38/comments","statuses_url":"https://api.github.com/repos/Vauxoo/odoo-afr/statuses/7a6f7576441f63695f91eb5ef00070f45f00fdb8","head":{"label":"vauxoo-dev:8.0-afr-test-hbto","ref":"8.0-afr-test-hbto","sha":"7a6f7576441f63695f91eb5ef00070f45f00fdb8","user":{"login":"vauxoo-dev","id":7662790,"avatar_url":"https://avatars.githubusercontent.com/u/7662790?v=3","gravatar_id":"","url":"https://api.github.com/users/vauxoo-dev","html_url":"https://github.com/vauxoo-dev","followers_url":"https://api.github.com/users/vauxoo-dev/followers","following_url":"https://api.github.com/users/vauxoo-dev/following{/other_user}","gists_url":"https://api.github.com/users/vauxoo-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/vauxoo-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vauxoo-dev/subscriptions","organizations_url":"https://api.github.com/users/vauxoo-dev/orgs","repos_url":"https://api.github.com/users/vauxoo-dev/repos","events_url":"https://api.github.com/users/vauxoo-dev/events{/privacy}","received_events_url":"https://api.github.com/users/vauxoo-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":26155130,"name":"odoo-afr","full_name":"vauxoo-dev/odoo-afr","owner":{"login":"vauxoo-dev","id":7662790,"avatar_url":"https://avatars.githubusercontent.com/u/7662790?v=3","gravatar_id":"","url":"https://api.github.com/users/vauxoo-dev","html_url":"https://github.com/vauxoo-dev","followers_url":"https://api.github.com/users/vauxoo-dev/followers","following_url":"https://api.github.com/users/vauxoo-dev/following{/other_user}","gists_url":"https://api.github.com/users/vauxoo-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/vauxoo-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vauxoo-dev/subscriptions","organizations_url":"https://api.github.com/users/vauxoo-dev/orgs","repos_url":"https://api.github.com/users/vauxoo-dev/repos","events_url":"https://api.github.com/users/vauxoo-dev/events{/privacy}","received_events_url":"https://api.github.com/users/vauxoo-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vauxoo-dev/odoo-afr","description":"odoo afr module","fork":true,"url":"https://api.github.com/repos/vauxoo-dev/odoo-afr","forks_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/forks","keys_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/teams","hooks_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/hooks","issue_events_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/issues/events{/number}","events_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/events","assignees_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/assignees{/user}","branches_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/branches{/branch}","tags_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/tags","blobs_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/git/refs{/sha}","trees_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/statuses/{sha}","languages_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/languages","stargazers_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/stargazers","contributors_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/contributors","subscribers_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/subscribers","subscription_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/subscription","commits_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/commits{/sha}","git_commits_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/git/commits{/sha}","comments_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/comments{/number}","issue_comment_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/issues/comments{/number}","contents_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/contents/{+path}","compare_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/merges","archive_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/downloads","issues_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/issues{/number}","pulls_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/pulls{/number}","milestones_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/milestones{/number}","notifications_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/labels{/name}","releases_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/releases{/id}","deployments_url":"https://api.github.com/repos/vauxoo-dev/odoo-afr/deployments","created_at":"2014-11-04T05:58:04Z","updated_at":"2014-11-04T05:55:55Z","pushed_at":"2016-07-06T10:15:09Z","git_url":"git://github.com/vauxoo-dev/odoo-afr.git","ssh_url":"git@github.com:vauxoo-dev/odoo-afr.git","clone_url":"https://github.com/vauxoo-dev/odoo-afr.git","svn_url":"https://github.com/vauxoo-dev/odoo-afr","homepage":null,"size":2857,"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":"Vauxoo:8.0","ref":"8.0","sha":"a149e7391ab33407c941083f5ae133ac33fb5fc8","user":{"login":"Vauxoo","id":5997834,"avatar_url":"https://avatars.githubusercontent.com/u/5997834?v=3","gravatar_id":"","url":"https://api.github.com/users/Vauxoo","html_url":"https://github.com/Vauxoo","followers_url":"https://api.github.com/users/Vauxoo/followers","following_url":"https://api.github.com/users/Vauxoo/following{/other_user}","gists_url":"https://api.github.com/users/Vauxoo/gists{/gist_id}","starred_url":"https://api.github.com/users/Vauxoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vauxoo/subscriptions","organizations_url":"https://api.github.com/users/Vauxoo/orgs","repos_url":"https://api.github.com/users/Vauxoo/repos","events_url":"https://api.github.com/users/Vauxoo/events{/privacy}","received_events_url":"https://api.github.com/users/Vauxoo/received_events","type":"Organization","site_admin":false},"repo":{"id":26155046,"name":"odoo-afr","full_name":"Vauxoo/odoo-afr","owner":{"login":"Vauxoo","id":5997834,"avatar_url":"https://avatars.githubusercontent.com/u/5997834?v=3","gravatar_id":"","url":"https://api.github.com/users/Vauxoo","html_url":"https://github.com/Vauxoo","followers_url":"https://api.github.com/users/Vauxoo/followers","following_url":"https://api.github.com/users/Vauxoo/following{/other_user}","gists_url":"https://api.github.com/users/Vauxoo/gists{/gist_id}","starred_url":"https://api.github.com/users/Vauxoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vauxoo/subscriptions","organizations_url":"https://api.github.com/users/Vauxoo/orgs","repos_url":"https://api.github.com/users/Vauxoo/repos","events_url":"https://api.github.com/users/Vauxoo/events{/privacy}","received_events_url":"https://api.github.com/users/Vauxoo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Vauxoo/odoo-afr","description":"odoo afr module","fork":false,"url":"https://api.github.com/repos/Vauxoo/odoo-afr","forks_url":"https://api.github.com/repos/Vauxoo/odoo-afr/forks","keys_url":"https://api.github.com/repos/Vauxoo/odoo-afr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Vauxoo/odoo-afr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Vauxoo/odoo-afr/teams","hooks_url":"https://api.github.com/repos/Vauxoo/odoo-afr/hooks","issue_events_url":"https://api.github.com/repos/Vauxoo/odoo-afr/issues/events{/number}","events_url":"https://api.github.com/repos/Vauxoo/odoo-afr/events","assignees_url":"https://api.github.com/repos/Vauxoo/odoo-afr/assignees{/user}","branches_url":"https://api.github.com/repos/Vauxoo/odoo-afr/branches{/branch}","tags_url":"https://api.github.com/repos/Vauxoo/odoo-afr/tags","blobs_url":"https://api.github.com/repos/Vauxoo/odoo-afr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Vauxoo/odoo-afr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Vauxoo/odoo-afr/git/refs{/sha}","trees_url":"https://api.github.com/repos/Vauxoo/odoo-afr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Vauxoo/odoo-afr/statuses/{sha}","languages_url":"https://api.github.com/repos/Vauxoo/odoo-afr/languages","stargazers_url":"https://api.github.com/repos/Vauxoo/odoo-afr/stargazers","contributors_url":"https://api.github.com/repos/Vauxoo/odoo-afr/contributors","subscribers_url":"https://api.github.com/repos/Vauxoo/odoo-afr/subscribers","subscription_url":"https://api.github.com/repos/Vauxoo/odoo-afr/subscription","commits_url":"https://api.github.com/repos/Vauxoo/odoo-afr/commits{/sha}","git_commits_url":"https://api.github.com/repos/Vauxoo/odoo-afr/git/commits{/sha}","comments_url":"https://api.github.com/repos/Vauxoo/odoo-afr/comments{/number}","issue_comment_url":"https://api.github.com/repos/Vauxoo/odoo-afr/issues/comments{/number}","contents_url":"https://api.github.com/repos/Vauxoo/odoo-afr/contents/{+path}","compare_url":"https://api.github.com/repos/Vauxoo/odoo-afr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Vauxoo/odoo-afr/merges","archive_url":"https://api.github.com/repos/Vauxoo/odoo-afr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Vauxoo/odoo-afr/downloads","issues_url":"https://api.github.com/repos/Vauxoo/odoo-afr/issues{/number}","pulls_url":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls{/number}","milestones_url":"https://api.github.com/repos/Vauxoo/odoo-afr/milestones{/number}","notifications_url":"https://api.github.com/repos/Vauxoo/odoo-afr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Vauxoo/odoo-afr/labels{/name}","releases_url":"https://api.github.com/repos/Vauxoo/odoo-afr/releases{/id}","deployments_url":"https://api.github.com/repos/Vauxoo/odoo-afr/deployments","created_at":"2014-11-04T05:55:02Z","updated_at":"2016-02-16T00:39:15Z","pushed_at":"2016-07-06T10:16:06Z","git_url":"git://github.com/Vauxoo/odoo-afr.git","ssh_url":"git@github.com:Vauxoo/odoo-afr.git","clone_url":"https://github.com/Vauxoo/odoo-afr.git","svn_url":"https://github.com/Vauxoo/odoo-afr","homepage":null,"size":3071,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":0,"default_branch":"8.0"}},"_links":{"self":{"href":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/38"},"html":{"href":"https://github.com/Vauxoo/odoo-afr/pull/38"},"issue":{"href":"https://api.github.com/repos/Vauxoo/odoo-afr/issues/38"},"comments":{"href":"https://api.github.com/repos/Vauxoo/odoo-afr/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Vauxoo/odoo-afr/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/Vauxoo/odoo-afr/statuses/7a6f7576441f63695f91eb5ef00070f45f00fdb8"}}}}
{"actor":{"display_login":"nhomar"}}