f44c5465701994e5bc9c8ea327b6baaa3e40e95c
When opening the Time Off App, the JS performs an rpc to call hr_leave_type.get_days_all_request. Inside this method there are some __get__ on non-stored computed fields. This triggers a recomputation of said fields in _compute_leaves. _compute_leaves uses _get_employees_days_per_allocation. When there is an hr.leave.type with request_unit = 'hour', you may get lots of validated allocations by employee. When this is the case, _get_employees_days_per_allocation gets quite slow, especially the last part about 'Future available leaves'. This commit optimizes this part of _get_employees_days_per_allocation. In this part the allocations are grouped by employees and Intervals instances are of the form (start, stop, records). This means that for a given employee_id, all the records of one Intervals will have the same start and stop values. This allows us to move the call to _get_work_days_data_batch outside of the for future_allocation_interval in future_allocation_intervals._items loop. Because _get_work_days_data_batch is quite expansive, moving it out grealty speeds up the _get_employees_days_per_allocation method. Example speedup: in a database with 50 validated allocations for the same hr.leave.type and employee_id, the timing of _get_employees_days_per_allocation 7.39s -> 158ms opw-3123457 closes odoo/odoo#117778 X-original-commit: 5a2efd2e5c3e65502c031f79f85319f3351f66e3 Signed-off-by: Kevin Baptiste <kba@odoo.com>
…
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%