Friday, July 1, 2022
1 change
Enhancements to existing features
Employees can now see daily and total overtime directly in the My Timesheets grid. This helps them quickly spot extra hours worked or missing timesheet entries, improving time tracking and reducing potential billing gaps.
Original PR description
…grid view This commit adds overtime information to the grid view in the "My Timesheet" page of the Timesheets app. Specifically it adds the daily and total overtime in the total row of the grid. The…
…grid view This commit adds overtime information to the grid view in the "My Timesheet" page of the Timesheets app. Specifically it adds the daily and total overtime in the total row of the grid. The overtime is calculated given the work hours specified in the employee record of each employee and the hours that have been timesheeted. The overtime can be positive (when the user has worked more hours or when the user has worked on a day not specified in their employee record) or negative (when the user has timesheeted less hours than what is specified in their employee record). When the overtime is zero, it is not printed. The overtime information is added on present or past dates and the total overtime information is computed for dates prior and including the present date. It is very important to the company and its employees that they encode all of their timesheets. They need to see at a glance the overtime that they have done (that might be paid by the company) or the time that is missing (missing time means the company might lose money on time it could have invoiced). The improvement that this task introduces ensures that all employees can easily keep track what they have yet to timesheet as well as whether they have been productive enough at a glance, from their defualt view in the Timesheet app. In order to implement this improvement, the "Float Time Grid" component needed to be extended in order to include the overtime information. This meant that we created a new component: the "Overtime" grid component. For that, overtime_grid_component.js file needed to be created for the new component as well as the overtimeGridComponent.xml file for the QWeb template. To get the work hours information (which is essential to the overtime computation) we made an rpc call to the hr_employee model inside of the timesheet_time_grid_model.js Additionally, for the (total) overtime computation, the timesheet_timer_grid_rendered.js file was modified to include the necessary methods. One to caclulate the daily overtime, one to calculate the total overtime, and one to check whether to overtime should be computed (used by the other two methods mentioned). For the sake of cohesion, we wanted the overtime to always be under the total time in the total grid row. For that, we created a new class in timesheet_grid.scss to accept the \n character when printing the overtime. We also modified the timesheet_grid.xml file, in order to change the grid table template to include the prop of our new component - the overtime value. Finally, we modified the hr_timesheet_view.xml to again include the new overtime grid component in the "My Timesheets" page's grid view and we modified the manifest file to include the new component. task-2878635