{"action":"created","issue":{"url":"https://api.github.com/repos/odoo/odoo/issues/8537","labels_url":"https://api.github.com/repos/odoo/odoo/issues/8537/labels{/name}","comments_url":"https://api.github.com/repos/odoo/odoo/issues/8537/comments","events_url":"https://api.github.com/repos/odoo/odoo/issues/8537/events","html_url":"https://github.com/odoo/odoo/issues/8537","id":106551224,"number":8537,"title":"[8.0] Too many calculations on price_subtotal field on sale.order.line","user":{"login":"hugosantosred","id":200092,"avatar_url":"https://avatars.githubusercontent.com/u/200092?v=3","gravatar_id":"","url":"https://api.github.com/users/hugosantosred","html_url":"https://github.com/hugosantosred","followers_url":"https://api.github.com/users/hugosantosred/followers","following_url":"https://api.github.com/users/hugosantosred/following{/other_user}","gists_url":"https://api.github.com/users/hugosantosred/gists{/gist_id}","starred_url":"https://api.github.com/users/hugosantosred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hugosantosred/subscriptions","organizations_url":"https://api.github.com/users/hugosantosred/orgs","repos_url":"https://api.github.com/users/hugosantosred/repos","events_url":"https://api.github.com/users/hugosantosred/events{/privacy}","received_events_url":"https://api.github.com/users/hugosantosred/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"rco-odoo","id":7578141,"avatar_url":"https://avatars.githubusercontent.com/u/7578141?v=3","gravatar_id":"","url":"https://api.github.com/users/rco-odoo","html_url":"https://github.com/rco-odoo","followers_url":"https://api.github.com/users/rco-odoo/followers","following_url":"https://api.github.com/users/rco-odoo/following{/other_user}","gists_url":"https://api.github.com/users/rco-odoo/gists{/gist_id}","starred_url":"https://api.github.com/users/rco-odoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rco-odoo/subscriptions","organizations_url":"https://api.github.com/users/rco-odoo/orgs","repos_url":"https://api.github.com/users/rco-odoo/repos","events_url":"https://api.github.com/users/rco-odoo/events{/privacy}","received_events_url":"https://api.github.com/users/rco-odoo/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2015-09-15T13:06:47Z","updated_at":"2015-10-22T14:44:58Z","closed_at":null,"body":"We are experiencing issues when saving big sale orders (~ 500 Lines) it always throws a CPU Time limit Exceeded error.\r\n\r\nDebugging this I've noticed than price_subtotal field is recomputed too many times (Also I tested with a database with demo data and only sale module installed)\r\n\r\nI've put a logger in _amount_line in sale.py and for a 2 line sale order is doing this:\r\n\r\n```\r\n2015-09-15 12:46:15,900 11808 WARNING test_big_so openerp.addons.sale.sale: AMOUNT LINE [15, 798]\r\n2015-09-15 12:46:15,947 11808 WARNING test_big_so openerp.addons.sale.sale: AMOUNT LINE [15, 798]\r\n2015-09-15 12:46:15,963 11808 WARNING test_big_so openerp.addons.sale.sale: AMOUNT LINE [15, 798]\r\n2015-09-15 12:46:16,236 11808 WARNING test_big_so openerp.addons.sale.sale: AMOUNT LINE [15, 798]\r\n```\r\n\r\nSo if the order has 500 lines, when saving it, will block the ERP in multiple workers mode or it will spend nearly a half hour on saving this sale order.\r\n\r\nTo reproduce this behaviour:\r\n- Create a new sale order\r\n- Add many lines to it and save the order (This time this error is not going to happen and the order will save as expected)\r\n- Change the fiscal position in the order, so it will update the taxes on all the lines\r\n- Save the order again. (Now it's going to spend a lot of time calculating amount_line in the order)\r\n\r\n\r\nAnyone else has noticed this behaviour?"},"comment":{"url":"https://api.github.com/repos/odoo/odoo/issues/comments/150247771","html_url":"https://github.com/odoo/odoo/issues/8537#issuecomment-150247771","issue_url":"https://api.github.com/repos/odoo/odoo/issues/8537","id":150247771,"user":{"login":"JakeStoeffler","id":2073367,"avatar_url":"https://avatars.githubusercontent.com/u/2073367?v=3","gravatar_id":"","url":"https://api.github.com/users/JakeStoeffler","html_url":"https://github.com/JakeStoeffler","followers_url":"https://api.github.com/users/JakeStoeffler/followers","following_url":"https://api.github.com/users/JakeStoeffler/following{/other_user}","gists_url":"https://api.github.com/users/JakeStoeffler/gists{/gist_id}","starred_url":"https://api.github.com/users/JakeStoeffler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JakeStoeffler/subscriptions","organizations_url":"https://api.github.com/users/JakeStoeffler/orgs","repos_url":"https://api.github.com/users/JakeStoeffler/repos","events_url":"https://api.github.com/users/JakeStoeffler/events{/privacy}","received_events_url":"https://api.github.com/users/JakeStoeffler/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T14:44:58Z","updated_at":"2015-10-22T14:44:58Z","body":"Does this also affect OpenERP v7?  I have a client whose large sales orders (~300 lines) are taking upwards of five minutes to confirm (from quote to order).  I had to increase `limit_time_cpu` and `limit_time_real` to get them to work at all -- otherwise it would always time out after a minute.  This long load time is simply not acceptable for them.  Does anyone have a solution?"}}