{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/bank-statement-import/pulls/comments/52154580","id":52154580,"diff_hunk":"@@ -349,6 +349,15 @@ def _complete_statement(self, stmt_vals, journal_id, account_number):\n                         bank_account_id = bank_obj and bank_obj.id or False\n                 line_vals['partner_id'] = partner_id\n                 line_vals['bank_account_id'] = bank_account_id\n+        if 'date' in stmt_vals and 'period_id' not in stmt_vals:\n+            # if the parser found a date but didn't set a period for this date,\n+            # do this now\n+            try:\n+                stmt_vals['period_id'] =\\\n+                    self.env['account.period'].find(dt=stmt_vals['date']).id","path":"account_bank_statement_import/models/account_bank_statement_import.py","position":18,"original_position":18,"commit_id":"b12f4908d2dbd612d162d68e32acdf9b8c4778a7","original_commit_id":"b12f4908d2dbd612d162d68e32acdf9b8c4778a7","user":{"login":"sbidoul","id":692075,"avatar_url":"https://avatars.githubusercontent.com/u/692075?v=3","gravatar_id":"","url":"https://api.github.com/users/sbidoul","html_url":"https://github.com/sbidoul","followers_url":"https://api.github.com/users/sbidoul/followers","following_url":"https://api.github.com/users/sbidoul/following{/other_user}","gists_url":"https://api.github.com/users/sbidoul/gists{/gist_id}","starred_url":"https://api.github.com/users/sbidoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbidoul/subscriptions","organizations_url":"https://api.github.com/users/sbidoul/orgs","repos_url":"https://api.github.com/users/sbidoul/repos","events_url":"https://api.github.com/users/sbidoul/events{/privacy}","received_events_url":"https://api.github.com/users/sbidoul/received_events","type":"User","site_admin":false},"body":"According to https://github.com/odoo/odoo/blob/8.0/addons/account/account.py#L1042, you should put account_period_prefer_normal=True in the context to avoid obtaining an opening period.","created_at":"2016-02-08T10:49:04Z","updated_at":"2016-02-08T10:49:04Z","html_url":"https://github.com/OCA/bank-statement-import/pull/58#discussion_r52154580","pull_request_url":"https://api.github.com/repos/OCA/bank-statement-import/pulls/58","_links":{"self":{"href":"https://api.github.com/repos/OCA/bank-statement-import/pulls/comments/52154580"},"html":{"href":"https://github.com/OCA/bank-statement-import/pull/58#discussion_r52154580"},"pull_request":{"href":"https://api.github.com/repos/OCA/bank-statement-import/pulls/58"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/bank-statement-import/pulls/58","id":58590926,"html_url":"https://github.com/OCA/bank-statement-import/pull/58","diff_url":"https://github.com/OCA/bank-statement-import/pull/58.diff","patch_url":"https://github.com/OCA/bank-statement-import/pull/58.patch","issue_url":"https://api.github.com/repos/OCA/bank-statement-import/issues/58","number":58,"state":"open","locked":false,"title":"[IMP] if there's a date but no period, ger the date's period","user":{"login":"hbrunn","id":2563186,"avatar_url":"https://avatars.githubusercontent.com/u/2563186?v=3","gravatar_id":"","url":"https://api.github.com/users/hbrunn","html_url":"https://github.com/hbrunn","followers_url":"https://api.github.com/users/hbrunn/followers","following_url":"https://api.github.com/users/hbrunn/following{/other_user}","gists_url":"https://api.github.com/users/hbrunn/gists{/gist_id}","starred_url":"https://api.github.com/users/hbrunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hbrunn/subscriptions","organizations_url":"https://api.github.com/users/hbrunn/orgs","repos_url":"https://api.github.com/users/hbrunn/repos","events_url":"https://api.github.com/users/hbrunn/events{/privacy}","received_events_url":"https://api.github.com/users/hbrunn/received_events","type":"User","site_admin":false},"body":"First, I though that was a deficiency in the mt940 parsers, but now I figure we can do this centrally. Of should I move it to the parser where I need it?\r\n\r\nIf we don't set a `period_id`, we'll get the current date's period, which is most probably wrong.","created_at":"2016-02-08T10:24:19Z","updated_at":"2016-02-08T10:49:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7644856e1d6481b85a369caa106ba4126b441afb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OCA/bank-statement-import/pulls/58/commits","review_comments_url":"https://api.github.com/repos/OCA/bank-statement-import/pulls/58/comments","review_comment_url":"https://api.github.com/repos/OCA/bank-statement-import/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/bank-statement-import/issues/58/comments","statuses_url":"https://api.github.com/repos/OCA/bank-statement-import/statuses/b12f4908d2dbd612d162d68e32acdf9b8c4778a7","head":{"label":"hbrunn:8.0-set_period_id_from_date","ref":"8.0-set_period_id_from_date","sha":"b12f4908d2dbd612d162d68e32acdf9b8c4778a7","user":{"login":"hbrunn","id":2563186,"avatar_url":"https://avatars.githubusercontent.com/u/2563186?v=3","gravatar_id":"","url":"https://api.github.com/users/hbrunn","html_url":"https://github.com/hbrunn","followers_url":"https://api.github.com/users/hbrunn/followers","following_url":"https://api.github.com/users/hbrunn/following{/other_user}","gists_url":"https://api.github.com/users/hbrunn/gists{/gist_id}","starred_url":"https://api.github.com/users/hbrunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hbrunn/subscriptions","organizations_url":"https://api.github.com/users/hbrunn/orgs","repos_url":"https://api.github.com/users/hbrunn/repos","events_url":"https://api.github.com/users/hbrunn/events{/privacy}","received_events_url":"https://api.github.com/users/hbrunn/received_events","type":"User","site_admin":false},"repo":{"id":36432768,"name":"bank-statement-import","full_name":"hbrunn/bank-statement-import","owner":{"login":"hbrunn","id":2563186,"avatar_url":"https://avatars.githubusercontent.com/u/2563186?v=3","gravatar_id":"","url":"https://api.github.com/users/hbrunn","html_url":"https://github.com/hbrunn","followers_url":"https://api.github.com/users/hbrunn/followers","following_url":"https://api.github.com/users/hbrunn/following{/other_user}","gists_url":"https://api.github.com/users/hbrunn/gists{/gist_id}","starred_url":"https://api.github.com/users/hbrunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hbrunn/subscriptions","organizations_url":"https://api.github.com/users/hbrunn/orgs","repos_url":"https://api.github.com/users/hbrunn/repos","events_url":"https://api.github.com/users/hbrunn/events{/privacy}","received_events_url":"https://api.github.com/users/hbrunn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hbrunn/bank-statement-import","description":"","fork":true,"url":"https://api.github.com/repos/hbrunn/bank-statement-import","forks_url":"https://api.github.com/repos/hbrunn/bank-statement-import/forks","keys_url":"https://api.github.com/repos/hbrunn/bank-statement-import/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hbrunn/bank-statement-import/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hbrunn/bank-statement-import/teams","hooks_url":"https://api.github.com/repos/hbrunn/bank-statement-import/hooks","issue_events_url":"https://api.github.com/repos/hbrunn/bank-statement-import/issues/events{/number}","events_url":"https://api.github.com/repos/hbrunn/bank-statement-import/events","assignees_url":"https://api.github.com/repos/hbrunn/bank-statement-import/assignees{/user}","branches_url":"https://api.github.com/repos/hbrunn/bank-statement-import/branches{/branch}","tags_url":"https://api.github.com/repos/hbrunn/bank-statement-import/tags","blobs_url":"https://api.github.com/repos/hbrunn/bank-statement-import/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hbrunn/bank-statement-import/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hbrunn/bank-statement-import/git/refs{/sha}","trees_url":"https://api.github.com/repos/hbrunn/bank-statement-import/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hbrunn/bank-statement-import/statuses/{sha}","languages_url":"https://api.github.com/repos/hbrunn/bank-statement-import/languages","stargazers_url":"https://api.github.com/repos/hbrunn/bank-statement-import/stargazers","contributors_url":"https://api.github.com/repos/hbrunn/bank-statement-import/contributors","subscribers_url":"https://api.github.com/repos/hbrunn/bank-statement-import/subscribers","subscription_url":"https://api.github.com/repos/hbrunn/bank-statement-import/subscription","commits_url":"https://api.github.com/repos/hbrunn/bank-statement-import/commits{/sha}","git_commits_url":"https://api.github.com/repos/hbrunn/bank-statement-import/git/commits{/sha}","comments_url":"https://api.github.com/repos/hbrunn/bank-statement-import/comments{/number}","issue_comment_url":"https://api.github.com/repos/hbrunn/bank-statement-import/issues/comments{/number}","contents_url":"https://api.github.com/repos/hbrunn/bank-statement-import/contents/{+path}","compare_url":"https://api.github.com/repos/hbrunn/bank-statement-import/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hbrunn/bank-statement-import/merges","archive_url":"https://api.github.com/repos/hbrunn/bank-statement-import/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hbrunn/bank-statement-import/downloads","issues_url":"https://api.github.com/repos/hbrunn/bank-statement-import/issues{/number}","pulls_url":"https://api.github.com/repos/hbrunn/bank-statement-import/pulls{/number}","milestones_url":"https://api.github.com/repos/hbrunn/bank-statement-import/milestones{/number}","notifications_url":"https://api.github.com/repos/hbrunn/bank-statement-import/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hbrunn/bank-statement-import/labels{/name}","releases_url":"https://api.github.com/repos/hbrunn/bank-statement-import/releases{/id}","deployments_url":"https://api.github.com/repos/hbrunn/bank-statement-import/deployments","created_at":"2015-05-28T11:02:28Z","updated_at":"2015-05-28T11:02:28Z","pushed_at":"2016-02-08T10:22:31Z","git_url":"git://github.com/hbrunn/bank-statement-import.git","ssh_url":"git@github.com:hbrunn/bank-statement-import.git","clone_url":"https://github.com/hbrunn/bank-statement-import.git","svn_url":"https://github.com/hbrunn/bank-statement-import","homepage":null,"size":486,"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":"e53fc850c676996fbd53a07ef8f164456259ae19","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":26747622,"name":"bank-statement-import","full_name":"OCA/bank-statement-import","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/bank-statement-import","description":"Bank Import Addons","fork":false,"url":"https://api.github.com/repos/OCA/bank-statement-import","forks_url":"https://api.github.com/repos/OCA/bank-statement-import/forks","keys_url":"https://api.github.com/repos/OCA/bank-statement-import/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/bank-statement-import/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/bank-statement-import/teams","hooks_url":"https://api.github.com/repos/OCA/bank-statement-import/hooks","issue_events_url":"https://api.github.com/repos/OCA/bank-statement-import/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/bank-statement-import/events","assignees_url":"https://api.github.com/repos/OCA/bank-statement-import/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/bank-statement-import/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/bank-statement-import/tags","blobs_url":"https://api.github.com/repos/OCA/bank-statement-import/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/bank-statement-import/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/bank-statement-import/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/bank-statement-import/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/bank-statement-import/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/bank-statement-import/languages","stargazers_url":"https://api.github.com/repos/OCA/bank-statement-import/stargazers","contributors_url":"https://api.github.com/repos/OCA/bank-statement-import/contributors","subscribers_url":"https://api.github.com/repos/OCA/bank-statement-import/subscribers","subscription_url":"https://api.github.com/repos/OCA/bank-statement-import/subscription","commits_url":"https://api.github.com/repos/OCA/bank-statement-import/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/bank-statement-import/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/bank-statement-import/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/bank-statement-import/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/bank-statement-import/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/bank-statement-import/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/bank-statement-import/merges","archive_url":"https://api.github.com/repos/OCA/bank-statement-import/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/bank-statement-import/downloads","issues_url":"https://api.github.com/repos/OCA/bank-statement-import/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/bank-statement-import/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/bank-statement-import/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/bank-statement-import/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/bank-statement-import/labels{/name}","releases_url":"https://api.github.com/repos/OCA/bank-statement-import/releases{/id}","deployments_url":"https://api.github.com/repos/OCA/bank-statement-import/deployments","created_at":"2014-11-17T08:38:06Z","updated_at":"2016-01-27T14:39:22Z","pushed_at":"2016-02-08T10:24:20Z","git_url":"git://github.com/OCA/bank-statement-import.git","ssh_url":"git@github.com:OCA/bank-statement-import.git","clone_url":"https://github.com/OCA/bank-statement-import.git","svn_url":"https://github.com/OCA/bank-statement-import","homepage":"https://odoo-community.org/project/banking-maintainers-10","size":799,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":51,"mirror_url":null,"open_issues_count":16,"forks":51,"open_issues":16,"watchers":16,"default_branch":"9.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/bank-statement-import/pulls/58"},"html":{"href":"https://github.com/OCA/bank-statement-import/pull/58"},"issue":{"href":"https://api.github.com/repos/OCA/bank-statement-import/issues/58"},"comments":{"href":"https://api.github.com/repos/OCA/bank-statement-import/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/bank-statement-import/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/bank-statement-import/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/bank-statement-import/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/bank-statement-import/statuses/b12f4908d2dbd612d162d68e32acdf9b8c4778a7"}}}}