The @api.onchange, modifying compensation_nb according to working mode,
led to strange behavior and lack of consistency.
compensation_nb has consequently moved in Shift Stage.
This adds a configurable limit under which the regular worker is
unsubscribed. The regular worker is unsubscribed when the sum of his
shift counter and his compensation shift counter reach the configured
limit.
This improves the calculation of the future alert date in other to take
holidays and temporary exemption into account.
This also adds the date of the next countdown that also take holidays
and temporary exemption into account.
Before this commit, the alert_start_time was not erased when a status
change from 'alert' to 'ok' for an irregular worker.
People find that unintuitive (despite this date was in the past when
you are in 'ok' status).
Now, this alert_start_time was erased when the status change from
'alert' to 'ok'.
This fix the case where a worker is unsubscribed from a shift where he
is supercooperator.
In the function unsubscribed_from_today, when removing the supercoop,
the field is_regular was also set to False. I seams that this is not
correct as this field is related to the worker_id not to the supercoop.
Also, I found other issues as when removing a worker_id the fields
is_regular and is_compensation was not reset.
This let me think about other cases where worker_id is emptied, the
is_regular and is_compensation would be never been reset if the
programmer doesn't think to reset it.
So I modified the constrains on these field in order to have these field
reset properly when worker_id is changed.
This commit brings fix a bug that occur when a worker do a shift before
her future_alert_date and the shift was marked as attended after the
future_alert_date. In such a case, the worker fell in alert state and
get a -2. This don't fix the fact that the worker fall in alert. But
brings correction when the shift is finally marked as attended.