Closed jgrandguillaume closed 5 years ago
Hi @jgrandguillaume, just a comment from my side based on today's testing with "real" data on the INT.
Thanks and regards, Stefan
The problem is not having 160 attendances, but the contrary: not having a lot of missing attendances, as in that case, the theoretical hours should be computed on the fly. On this case, you have about 40 working days, but only attendances for basically 1 day, so 39 130 4 (this is due to the subtotal and total cells) = 20280 computations should be done on the fly, which is the reason why 2 minutes are needed.
I don't think this is a real use case, or at least, it should be a case for a full year, where all the employees have taken all their leaves (and even in that case, the number of missing attendances should be lower).
You can tweak this by setting the "Theoretical Hours Start Date` field in each employee, starting from the real date where you are going to start the attendances. Try this, and for sure the performance will be better.
How can we improve more the performance?
Digging in Odoo core method for getting the theoretical hours. In v10, we use a custom method for getting this, but now on v12 we are using a call to a core method:
The way to exclude those leaves with the check "Include in theoretical hours" is done through an Odoo domain with dot notation:
We know by historical reasons that this can be less performant in some cases. I don't think this should be critical, as the number of leave types shouldn't be very high, but it's another possibility.
Enabling the cache in the method that gets the theoretical hours for not multiplying by 4 each time you get a result:
The problem I had enabling was to get a proper way to invalidate the cache when relevant data changes, and even with that, Odoo invalidates the cache in other cases, making this useless for half of the time.
Other thing that I was going to comment is what @shartenfels has already commented meanwhile I was writing this: all employees are shown only in case of HR officers or managers, that indeed is intended for a full picture. If you don't want this, simply save a favorite as default with only your attendances.
Hi,
Thanks for the quick answer @pedrobaeza ! Let's leave this as it is and see when we do have more data then. Can I suggest to implement this default filter for all users:
My attendances
Current year
That would ease the performance issue and be also more convenient for most of the use cases -> you want to check your own attendances most of the time. And the yearly picture is also required most of the time because if you look at the 2 months only (current and previous one), then the total difference is wrong. I mean it is computed properly, but as you report overdue hours on a yearly basis, then you do not have the proper total (e.g. +10 hour in january, 0 in February, 0 in March, you are in April, then the difference will be 0).
What do you say ?
Regards,
Joël
Hi, @jgrandguillaume, about the default filters:
I was suggesting this as it seems to be the defaut people wants (having 2 month doesn't provide the good sum as it is managed yearly). But OK for me I close the issue.
Hi,
Using hr_attendance_report_theoretical_time on v12 with 130 employees and ~160 attendances "only" the table takes around 2 minutes to display when I open "Theoretical vs Attended Time Analysis" with HR manager access right . I only display current year, meaning 2 months..
I'm worried that this reports won't handle a real use cases here..
Regards
Joël