When creating timesheet,
default from-date and to-date are adjusted for user timezone.
Fixes#3627
User timezone considered when assigning attendance records to timesheet
Fixes#3628Closes#3632
While working on project task it is possible
to record "task work" that will automatically
create timesheet lines. These are not by default
included into any timesheet, but they need to
appear in reporting nonetheless.
These lines disappeared from the analysis view
after the performance improvement of
rev. fe31451899
which introduced a JOIN with the `totals`
CTE table - and should have been LEFT JOIN.
This rev. is related to rev. 89093a2
If several account analytic lines where defined for a same date
within a same sheet, the report totals were multiplied by
the number of occurences of lines of the same day.
Before the above rev., only `Diff`, `Total`, `Timesheet`, were wrong
After, other totals were wrong as well.
The point of the above rev. was to gain a real performance improvment
when there was a lot of timesheets / analytic lines entered
in database. This rev. keeps this performance improvment.
opw-629857
The timezone of hr_analytic_sheet should be the timezone
of the employee as well, so sheet analytic lines and attendances
lines are grouped within the same timezone, the timezone
of the employees, so the time difference between the analytic
lines and the attendances lines can be properly computed.
Fixes#5809Fixes#5379
Related to rev. 3bf1615ad4
In a timesheet, when a sign in is added, and a sign out
is not following, the current time is took as sign out value.
Rev. dbb2a669f4 corrected an issue
regarding the worked hours summary not taking into account
the employee timezone.
This timezone has to be applied on the current_time also.
e.g: For an employee being in timezone UTC + 1
If the current_time is presently 12:00 (UTC+1)
If the employee set his sign in to 10:00
and do not entered a sign out
The hours summary table displayed 1:00 of worked hours,
based on computation (11:00 - 10:00)
11:00 being 12:00 but in timezone UTC
Besides, another issue was present when entering
a sign in at midnight exactly without a sign out:
If the employee set his sign in to 00:00:00
and do not set a sign out, worked hours displayed 0 worked hours
whatever the current time.
Fixes#5379Closes#5378Closes#5503
Adaptation of afe4a97d03, but we properly unlink the timesheet lines themselves instead of going for the account.analytic.lines like the original commit proposition did. Actually, the unlink method of hr.analytic.timesheet already unlinks the corresponding acount.analytic.line, but those records were previously deleted via ondelete='cascade', which didn't trigger the unlink method at all, so the associated analytic lines were not deleted accordingly.
Fixes opw 628256.
The module analytic_user_function allows to define a specific product
to use, when creating timesheet activities for a specific employee
with a specific contract
Nevertheless, the product was not set accordingly to this feature
for the first timesheet activity, because,
when initilialing the timesheet line,
the on_change_account_id, which returns
the product to use according to the user and contract, was called
without passing the user.
Besides, by default, on_change_account_id does not have a user_id parameter,
this parameter is added by the module analytic_user_function, overriding
this onchange, and adding a new user_id parameter (which is not a good pratice).
We therefore use multi_on_change_account_id, which allow to pass the user_id,
within the context
In 7.0, prevent changes in activities of validated sheets was done thanks to the constraint
_check_sheet_state.
In 7.0, python constraints were checked at each write operations
whatever if the fields on which the constraint is were altered or not
This is no longer the case in Odoo 8.0: The constraint is checked
only if the fields on which the constraint is are altered.
As this specific constraint must be applied anytime, whatever the altered fields,
we now do this constraint check in the "write" method.
Besides, it was already the case for the unlink method.
opw-627415
Once a timesheet confirmed, the activity hours should not be modified,
for any reasons.
The constraint _check_sheet_state prevents to modify activities
for confirmed timesheets, but does not prevent the addition
of new activities within the current, but confirmed, timesheet.
opw-627415
fixes#5128
The constraint prevent sheets to overlap was broken because it relies on a check on the
user_id. The problem is that the latter uses an old-api function field
that is not recomputed yet at the time of the validation. The fix consists in
using a non-computed field instead.
This rev. is related to:
- 4fb9c8f0dc
- 6c78541978Closes#4217
opw-620175
If an employee in UTC + 1 (Europe/Brussels) entered an attendance from January 2 00:00 to Januay 2 23:59, the summary by day table displayed two different lines, for two different days:
- 1 hour on January 1 from 23:00 to 23:59
- 22:59 hours on January 2 from 00:00 to 22:59
Which is obviously wrong, the employee, in its own time zone, worked on January 2 only.
hr.timesheet.report was moved from hr_timesheet_sheet to hr_timesheet but not the ir.model.access
Avoid warning "The model hr.timesheet.report has no access rules, consider adding one."
Fixes#3319