{"action":"created","issue":{"url":"https://api.github.com/repos/odoo/odoo/issues/16810","repository_url":"https://api.github.com/repos/odoo/odoo","labels_url":"https://api.github.com/repos/odoo/odoo/issues/16810/labels{/name}","comments_url":"https://api.github.com/repos/odoo/odoo/issues/16810/comments","events_url":"https://api.github.com/repos/odoo/odoo/issues/16810/events","html_url":"https://github.com/odoo/odoo/pull/16810","id":226326504,"number":16810,"title":"[FIX] stock: PO line with unit_price = 0 in real time","user":{"login":"simongoffin","id":5430156,"avatar_url":"https://avatars2.githubusercontent.com/u/5430156?v=3","gravatar_id":"","url":"https://api.github.com/users/simongoffin","html_url":"https://github.com/simongoffin","followers_url":"https://api.github.com/users/simongoffin/followers","following_url":"https://api.github.com/users/simongoffin/following{/other_user}","gists_url":"https://api.github.com/users/simongoffin/gists{/gist_id}","starred_url":"https://api.github.com/users/simongoffin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simongoffin/subscriptions","organizations_url":"https://api.github.com/users/simongoffin/orgs","repos_url":"https://api.github.com/users/simongoffin/repos","events_url":"https://api.github.com/users/simongoffin/events{/privacy}","received_events_url":"https://api.github.com/users/simongoffin/received_events","type":"User","site_admin":false},"labels":[{"id":106174181,"url":"https://api.github.com/repos/odoo/odoo/labels/OE","name":"OE","color":"a24689","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-05-04T15:50:19Z","updated_at":"2017-05-10T09:52:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/odoo/odoo/pulls/16810","html_url":"https://github.com/odoo/odoo/pull/16810","diff_url":"https://github.com/odoo/odoo/pull/16810.diff","patch_url":"https://github.com/odoo/odoo/pull/16810.patch"},"body":"Let's consider the stockable product P with an internal category set\r\nwith cost_method = 'real' and property_valuation = 'real_time'.\r\nWhen creating a PO with P and a unit_price=0, after delivering the product,\r\nthe cost transfered to the stock valuation account was equal to the product cost multplied by\r\nthe product quantity instead of the unit_price set on the PO multiplied by the quantity.\r\n\r\nPS: The quant is created with the stock.move in _quant_create_from_move and the unit_price\r\nset on the stock.move is taken with function get_price_unit.\r\n\r\nopw:740865\r\n"},"comment":{"url":"https://api.github.com/repos/odoo/odoo/issues/comments/300433692","html_url":"https://github.com/odoo/odoo/pull/16810#issuecomment-300433692","issue_url":"https://api.github.com/repos/odoo/odoo/issues/16810","id":300433692,"user":{"login":"qdp-odoo","id":7628598,"avatar_url":"https://avatars1.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},"created_at":"2017-05-10T09:52:39Z","updated_at":"2017-05-10T09:52:39Z","body":"If I just read your code, I dunno what is it and all your comments and docstrings don't help me figuring it out.\r\n\r\nThat being said, I don't like how you implemented it: it really makes the function set_default_price_unit_from_product() useless. Can't you replace with \r\n\r\n```python\r\n501     def set_default_price_unit_from_product(self):\r\n502         \"\"\" Set price to move, important in inter-company moves or receipts with only one partner \"\"\"\r\n- 503         for move in self.filtered(lambda move: not move.price_unit):\r\n+ 503         for move in self.filtered(lambda move: move.price_unit is None):\r\n504             move.write({'price_unit': move.product_id.standard_price})\r\n\r\n```\r\n?"}}
{"actor":{"display_login":"qdp-odoo"}}