{"action":"created","issue":{"url":"https://api.github.com/repos/odoo/odoo/issues/8906","labels_url":"https://api.github.com/repos/odoo/odoo/issues/8906/labels{/name}","comments_url":"https://api.github.com/repos/odoo/odoo/issues/8906/comments","events_url":"https://api.github.com/repos/odoo/odoo/issues/8906/events","html_url":"https://github.com/odoo/odoo/pull/8906","id":109939372,"number":8906,"title":"[FIX] Non-existent key company_id in vals blocks write in corner cases","user":{"login":"wtaferner","id":362478,"avatar_url":"https://avatars.githubusercontent.com/u/362478?v=3","gravatar_id":"","url":"https://api.github.com/users/wtaferner","html_url":"https://github.com/wtaferner","followers_url":"https://api.github.com/users/wtaferner/followers","following_url":"https://api.github.com/users/wtaferner/following{/other_user}","gists_url":"https://api.github.com/users/wtaferner/gists{/gist_id}","starred_url":"https://api.github.com/users/wtaferner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wtaferner/subscriptions","organizations_url":"https://api.github.com/users/wtaferner/orgs","repos_url":"https://api.github.com/users/wtaferner/repos","events_url":"https://api.github.com/users/wtaferner/events{/privacy}","received_events_url":"https://api.github.com/users/wtaferner/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-06T05:48:05Z","updated_at":"2015-10-07T10:15:34Z","closed_at":"2015-10-07T10:15:34Z","pull_request":{"url":"https://api.github.com/repos/odoo/odoo/pulls/8906","html_url":"https://github.com/odoo/odoo/pull/8906","diff_url":"https://github.com/odoo/odoo/pull/8906.diff","patch_url":"https://github.com/odoo/odoo/pull/8906.patch"},"body":"## Impacted versions:\r\n8.0 and above\r\n\r\n## Steps to reproduce:\r\n* I doubt it does need a clear way to reproduce as it is about a missing check whether a key is available in vals or not. I was able to reproduce it while testing something else on runbot...most likely you might bump into it by not using multi company...\r\n\r\n## Current behavior:\r\n* An exception does block the write of account voucher in combination with the module account_check_writing\r\n\r\n```python\r\nTraceback (most recent call last):\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/http.py\", line 537, in _handle_exception\r\n    return super(JsonRequest, self)._handle_exception(exception)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/http.py\", line 574, in dispatch\r\n    result = self._call_function(**self.params)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/http.py\", line 310, in _call_function\r\n    return checked_call(self.db, *args, **kwargs)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/service/model.py\", line 113, in wrapper\r\n    return f(dbname, *args, **kwargs)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/http.py\", line 307, in checked_call\r\n    return self.endpoint(*a, **kw)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/http.py\", line 803, in __call__\r\n    return self.method(*args, **kw)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/http.py\", line 403, in response_wrap\r\n    response = f(*args, **kw)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/addons/web/controllers/main.py\", line 948, in call_kw\r\n    return self._call_kw(model, method, args, kwargs)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/addons/web/controllers/main.py\", line 940, in _call_kw\r\n    return checked_call(request.db, *args, **kwargs)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/service/model.py\", line 113, in wrapper\r\n    return f(dbname, *args, **kwargs)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/addons/web/controllers/main.py\", line 939, in checked_call\r\n    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/api.py\", line 250, in wrapper\r\n    return old_api(self, *args, **kwargs)\r\n  File \"/home/odoo/runbot/extra/runbot/static/build/105608-8-0-25634d/openerp/addons/account_check_writing/account_voucher.py\", line 99, in write\r\n    self.pool['res.company'].browse(cr, uid, vals['company_id']).currency_id.id, context=context)\r\nKeyError: 'company_id'\r\n\r\n```\r\n\r\n## Expected behavior:\r\n* Exception does not block writing account voucher\r\n\r\n@beledouxdenis \r\nCould you be so kind and merge this? I stumbled over it by coincidence...thank you!\r\n\r\nIt was introduced in https://github.com/odoo/odoo/commit/6a01718aef7bddf70e836b211938d85c29d8efec\r\n"},"comment":{"url":"https://api.github.com/repos/odoo/odoo/issues/comments/146142039","html_url":"https://github.com/odoo/odoo/pull/8906#issuecomment-146142039","issue_url":"https://api.github.com/repos/odoo/odoo/issues/8906","id":146142039,"user":{"login":"mart-e","id":564822,"avatar_url":"https://avatars.githubusercontent.com/u/564822?v=3","gravatar_id":"","url":"https://api.github.com/users/mart-e","html_url":"https://github.com/mart-e","followers_url":"https://api.github.com/users/mart-e/followers","following_url":"https://api.github.com/users/mart-e/following{/other_user}","gists_url":"https://api.github.com/users/mart-e/gists{/gist_id}","starred_url":"https://api.github.com/users/mart-e/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mart-e/subscriptions","organizations_url":"https://api.github.com/users/mart-e/orgs","repos_url":"https://api.github.com/users/mart-e/repos","events_url":"https://api.github.com/users/mart-e/events{/privacy}","received_events_url":"https://api.github.com/users/mart-e/received_events","type":"User","site_admin":false},"created_at":"2015-10-07T10:15:34Z","updated_at":"2015-10-07T10:15:34Z","body":"Thanks for the update. I have changed a bit to avoid unnecessary evaluations of the browse and merged it at 29d28b05e4b958ce5d8437b03c1bdf711a18ea85\r\nRegards"}}