project icon indicating copy to clipboard operation
project copied to clipboard

[14.0] Time_control unable to start/stop timer

Open bosd opened this issue 2 years ago • 4 comments

Module

timesheet_time_control

Describe the bug

The module cannot be used when there are multiple already invoiced timesheet lines with a duration of 0 hours.

To Reproduce

Affected versions: 13,14 ... Maybe 12??

Steps to reproduce the behavior: 1.Generate a timesheet line with amount 0. in a week. (or have a DB which already has this) 2. Create an invoice of the corresponding week. 3. Try to start a timer 4. Result:

%d running timers found. Cannot know which one to stop. "
                "Please stop them manually.
  1. Search the running timer. Press the stop button.
  2. Result: Cannot modify an timesheet line which is already invoiced.

So now the timers are in a blocked state. One cannot start a timer. But stopping the running timers to start a new one is also imposible. (As there can only be 2 running timer for the same user at one time.)

Expected behavior

  • Ignore the the already invoiced and closed timesheet lines as running timers.
  • Do not show the stop timer button on timesheet lines which cannot be stopped (invoiced lines).

Additional context Add any other context about the problem here. (e.g. OS, Python version, ...)

bosd avatar Mar 04 '22 07:03 bosd

It's your duty to stop timers before invoicing IMO. The time_control module is not aware of sale_timesheet module and shouldn't be.

pedrobaeza avatar Mar 04 '22 07:03 pedrobaeza

True, one should stop the timers self.

In this case that was impossible. This module was installed on a exsisting database. Which already used sale_timesheet and timesheet sheet.

In that db there were aleady invoiced timesheet lines with a duration of 0.

bosd avatar Mar 04 '22 07:03 bosd

Then you can add a pre-install hook on the module for avoiding to install the module if that things are found, or create a glue module between this one and sale_timesheet for excluding such situation.

pedrobaeza avatar Mar 04 '22 07:03 pedrobaeza

As I really like this module! I will work on a glue module to let those 2 work together.

bosd avatar Mar 04 '22 16:03 bosd