A more generic design for Timesheet Work


The timesheet module was initially designed to be used by both timesheet and project modules.
It was done on the old time by using the removed _inherits feature and now it is done with the manual creation of a timesheet work linked to the project work.
The idea is to propose a new design that will allow to use the timesheet module for any module (like production to record time spend).


We simplify the timesheet.work to be a flat list of records with only a Reference field to other models (like project.work).
The rec_name of timesheet.work will be computed by using the rec_name of the reference. So the search on rec_name should also do the search on all reference models (like the global search).
A unique constraint will be added on this Reference field and the company field.
A Mixin will be created for the model that wants to be linked to timesheet.work. It will automatically create the timesheet.work on create and delete it on delete. But also this creation/deletion will be condition to a property to allow to create for example a project on which it is not allowed to register timesheet lines.
The start/end date of timesheet.work will stay.
We should also allow to create timesheet.work without any reference, in this case a name is required.
This is for the purpose of recurring work like secretary.


  • Remove parent, children, left and right fields.
  • Remove timesheet_available field.
  • Drop required on name.
  • Fill the reference field with the linked project.work.
  • Remove the work field on project.work.



What about active field?

For example, in the timesheet related to a production, it will be great to mark the related works as inactive when the production is done, as it does not make sense to add timesheet lines on a done production.

I think active will stay and each model can manage to inactivate its work at one time.

If the new design wants to be more generic, I think we can change the field “employee” for “resource” in timesheet.line. This field must be a Reference field to other models (company.employee or a future company.resource or whatever…)

What other “resource” would you encode time-sheet lines?
For me, it is clear that only employee (I mean party who has a contractual relation with the company) has to encode.

In some factories is important to track machinery time use in production orders

I don’t see the point to store that in the same table as the employee nor to be able to record such machinery time for project.
This is specific to production and so it should stay in production.

I was thinking in other resources used in the work.timesheet like a meeting room, a company vehicle… but maybe you’re right and must be stored in other models

I think you are mixing up with resource reservation (for that, you can use CalDAV).

Really not, I was thinking in other “per hour” resources to invoice used in the work.timesheet, not only employee but they probably are beyond the reach of timesheet.

Here is the implementation: Issue 5599: A more generic design for Timesheet Work - Tryton issue tracker