[16.0][hr_timesheet_sheet] New timesheet lines are added at the bottom of the list
Module
hr_timesheet_sheet
Describe the bug
In List view, new timesheet lines are added at the bottom of the list whereas the lines are listed in reverse chronological order.
To Reproduce
Affected versions: 16.0
Steps to reproduce the behavior: Timesheets -> My Timesheets -> My Timesheets -> NEW
Expected behavior As it happens in 14.0, I would expect the new line to go at the top of the list so you can add the details and save quickly and to be consistent with the reverse chronological order used to list the entries.
Additional context I have tried on Firefox and Chrome in Windows and Linux and it's exactly the same. I have used hr_timesheet_sheet in 14.0 for a number of years and now I am testing 16.0 to see if I make the jump. It's a self-hosted server and I can provide more details of Python and modules upon request.
Hi @innovara
I can't reproduce this, on my side, new created sheet are displayed first in the list. If you still have the problem can you provide screenshots or a screencast?
Hi. Thanks for looking into this. I am not reporting a problem adding timesheets. I am reporting a problem adding lines to an existing timesheet.
Steps to reproduce the behavior: Timesheets -> My Timesheets -> My Timesheets -> NEW
Yes, I still have the problem and I could send a screencast but can you please confirm that you are trying to reproduce the problem adding a new line to an existing timesheet on the screen as per the path above?
In case you are still interested in looking into this, this a screencast on Odoo 17.0. Same as what I reported on 16.0. The new lines go at the bottom. On Odoo 14.0 they go at the top. I'll prepare a test environment for 14.0 and upload another screencast for comparison. It could be something to do with Odoo itself, rather than the timesheet add on, or web_widget_x2many_2d_matrix maybe.
https://github.com/user-attachments/assets/f22ca391-b1bb-4148-8f17-c753237e317a
Here is the screencast on 14.0, it took less time to set it up than I thought.
https://github.com/user-attachments/assets/ea0e91a6-6162-4419-beff-b162a0ad3b12
I've investigated this a bit more and it seems to me that the menu My Timesheets is just basically Odoo standard functionality. I've also set up a few test environments to see which version introduced the change.
In 15.0 it worked as in 14.0 with the new line going on top of the list.
https://github.com/user-attachments/assets/56edacfd-5eec-4e6e-833f-9090bd01072d
In 16.0 it starts to go to the bottom.
https://github.com/user-attachments/assets/aca6ebf8-6878-424b-a06b-fcd6361ca393
And I've also registered for a trial on Odoo and checked their Timesheet module on 18.0 and it does the same, it goes to the bottom.
https://github.com/user-attachments/assets/2aee3561-ec55-4089-806b-8aebaaf5caff
I will try my luck and open an issue on Odoo's repo. For me is a clear regression. When you have many lines, and professionals billing time on timesheets do have them, you don't want to scroll all the way down every time to complete the line.
After opening an issue on Odoo's repo I got pointed in the right direction and I traced down the change to the following commit and PR.
https://github.com/odoo/odoo/commit/4887354558513e0cdfaa3630c626e3f1705af8c5 https://github.com/odoo/odoo/pull/87630
So, what I see as an issue is to do with changing editable="top" to editable="bottom" on the view defined on addons/hr_timesheet/views/hr_timesheet_views.xml, which is nothing to do with hr_timesheet_sheet so I will close this issue.
Actually, there is a module to do this on 16.0 published after I opened this issue: https://github.com/OCA/timesheet/commits/16.0/hr_timesheet_editable_top
I hadn't seen it when I revisited this topic.