Commit Graph
2816 Commits
Author SHA1 Message Date
Lucas Lefèvre bad9190730 [FIX] hr_holidays: reload dashboard on new allocation
When a new allocation is requested from the leave dashboard,
the page is not reloaded. Therefore the displayed data is not
up to date with the new allocation count.

This commit makes the page reload after each new allocation.
2019-02-14 16:28:55 +01:00
Lucas Lefèvre d77ce4c2a9 [IMP] hr_*: introduce the employee profile
General Purpose
===============

We want an 'Employee profile' gathering every data about an employee.
The main form view is modified to become this employee profile.
A user can also see his own profile through the Preferences menu.
The new profile replaces the current Preferences view if the hr module is installed
and the current user is linked to an employee.

A user should be able to see and edit his own profile.

*Problem*:
Many fields on hr.employee are protected by groups="hr.group_hr_user".
Therefore, a regular user cannot see or edit those fields.

This protection must be bypassed to allow read/write access
to the regular user's own data.
A similar mechanism already exists for res.users (for Preferences)

The better (least worst) solution found is to reuse this mechanism by adding related fields on res.users.

Pros:
- Don't change security access on hr.employee
- Don't implement yet another custom security layer, risking to add new security breaches
- A lot of fields are added by other modules on hr.employee.
  It would have required to integrate them with the custom security layer.
- Fields added by other modules on the user's preferences view (normal view, not the profile)
  are automatically included in the employee's profile view.
- Allow the hr.employee form view to be different than the user profile accessible
  through the Preferences menu.
  E.g. add custom buttons only relevant to the logged in user such as "Request a leave".
Cons:
- Each field from hr.employee that you want to appear on its profile
  must be added as a related field on res.users
- Those related fields must be added to user's preferences view (duplicate views)
- They also must be added to SELF_[READABLE | WRITABLE]_FIELDS

Note:
When the front-end loads the views it gets the list of available fields
for the user (according to its access rights). Later, when the front-end wants to
populate the view with data, it only asks to read those available fields.
However, in this case, we want the user to be able to read/write its own data,
even if they are protected by groups (groups are kept on the related fields on res.users).
The front-end need to be made  aware of those fields by sending all field definitions.

hr_attendance
=============

This commit integrate attendance in the new employee profile.
It also adds a stat button to this employee profile showing
the number of hours worked last month.

Remove the boolean computed field 'manual_attendance'.
This field is just a shortcut to add/remove the employee's user
in the "Manual Attendance" group.
The checkbox is confusing on the employee's form and this should
be done through the normal group management screens.

hr_presence
===========

Display the presence status on the employee kanban template.
The status is a colored chip which can be green (present),
orange (to define) or red (absent).

Currently, the presence status is only computed when accessing
the report view. As this commits displays it on the employee kanban,
it should be updated more frequently.
The state should not be updated every time the kanban view is loaded
since the computation is a bit heavy. Instead: add a cron to update
status every 15 minutes.
-> The status is accurate on the report view (status is still updated
   when loading the view)
-> The status in accurate at 15 minutes on the kanban view

[ADD] hr_attendance_presence
============================

Bridge module between hr_attendance and hr_presence.

This commit integrates hr_presence module in the employee
profile and adds the presence status on the employee kanban view.
But hr_attendance adds at the same place a similar status icon for
checkin/checkout.
This bridge module makes the status from hr_presence invisible as
hr_attendance should be the main presence control mechanism.

Also, this commit adds the ability (through a new setting option)
for hr_presence to take into account checkin/checkout to determine
the presence status.

l10n_be_hr_payroll
==================
integration with employee profile
2019-02-14 16:28:54 +01:00
Lucas Lefèvre 0cd13b001a [IMP] hr, hr_holidays, hr_expense: Change onchange parent_id behaviour
Purpose
=======

When the manager (parent_id) of an employee changes,
it doesn't always mean that other responsibles (Leave responsible,
expense responsible, coach) should also change.

Specification
=============

When changing the employee's manager, the leave responsible,
the expense responsible and the coach should be changed only
if the field was not set or if the responsible is the previous manager.
In that case, they should be set to the new manager.
Otherwise, it means the field was most probably set manually and
it should be left unchanged.
2019-02-13 11:03:33 +01:00
Christophe Simonis 8c29df10e0 [MERGE] forward port branch saas-12.1 up to 93d736e905 2019-02-11 17:00:35 +01:00
XavierDo 975164473c [IMP] mail, hr_holidays: improve channel_info
`channel_info` can be called on multiple channels especially during
the init_messaging. The current implementation will perform read and
other queries in the loop. This commits aims to refactor `channel_info`
in order to read all informations in database out of the loop.

Computation of members informations is now the same as for `direct_partner`
As a side effect direct partner will have an email adress and members will have
im_status and out_of_office message if the partner is in a
channel of type chat. It would be easier to compute im_status in all case but
this could create performances issues when calling channel info on channel with
hundreds of users.

channel_fetch_preview will make a query in database in any case but seems to work ok
in api multi. We can put it out of the loop.

44ac7903cc fix shouldn't be broken by this refactoring since we are no longer using the many2many to find direct_partners.
2019-02-11 09:22:24 +00:00
XavierDo 086405344e [IMP] mail, hr_holidays: use leaves to compute im_status
When on leave, the im_status can be either leave_online or leave_offline.
This will allow to display a specific icon and a default message when the user
is not at the office.
The leave can have an out of office message. This message will be displayed
in the chat window instead of the user ooo message, and the end date of the leave will be displayed too.

Technical details.
Right now the im_status access leaves directly to know if a user is on leave or not.
An index has been added to optimise this request (thanks to rco).
A solution to optimise this would be to compute part of the information in a cron.

Task: 1856205
2019-02-07 12:53:03 +00:00
Christophe Simonis 87924cb5ad [MERGE] forward port branch 12.0 up to a46138cb01 2019-02-07 13:14:02 +01:00
Nicolas Seinlet aa9fb85102 [FIX] hr_holidays: cache direct access
Sometimes, cache returns an empty tuple, which makes
the .get hit and the [0] to miss, which leads to a
traceback.

closes odoo/odoo#30843
2019-02-05 15:08:33 +00:00
RomainLibert 9c1b932489 [IMP] hr_holidays: improve performances
going from 3X seconds for 320 leaves to 20 seconds for 320 leaves
2019-02-05 10:06:55 +01:00
RomainLibert 8ab8881167 [FIX] hr_holidays: fasten creation of leaves by company
When creating a leave, we usually check/create activities for the
concerned users, this is fine when creating one leave.
However it starts to become a problem when trying to create leaves in
batch using the by company or by department holiday_type as the number
of leaves created in batch can become quite big.

Now when we create leaves in batch, we do not check for the activities,
which will fasten a lot the creation.

Another problem is that when someone defined a leave on the very day you
want to create such a request, then it will crash, this can lead to
waste of time and resources.

Now we raise an error before trying to create the leaves in case of
conflict.

Task: 1934383
2019-02-05 10:06:55 +01:00
Odoo Translation Bot 69dbbea09a [I18N] Update translation terms from Transifex 2019-02-03 01:38:30 +01:00
Christophe Simonis f927c68ddb [MERGE] forward port branch 12.0 up to cb8fefa899 2019-01-31 16:59:58 +01:00
Julien (juc) Castiaux c7b6fcb9f2 [FIX] hr_holidays: Disable emails when importing from file
When using the "test import" feature to import leaves request, odoo
fails with a 500 error and no error message.

The only difference with a real import is that the test dry-runs by
rollbacking. The issue here is that mails are sent *after* a commit
is done hense crashes because they do not exist anymore.

opw-1916913

closes odoo/odoo#30523
2019-01-30 14:29:23 +00:00
Mohit Ghodasara bbd64c22ab [IMP] various: prevent unlink of automated activity types
Purpose of this merge is to update main addons and set activity types used
for automated activities as master data. This means they cannot be removed.
Indeed those activity types are used in business flow to generate activities
and removing them may break some flows.

This commit is linked to task ID 1907970 and PR #29257.
2019-02-05 11:32:14 +00:00
Christophe Simonis 4400cce820 [MERGE] forward port branch saas-12.1 up to 4524ad06a8 2019-02-04 13:27:22 +01:00
Odoo Translation Bot fe36bff420 [I18N] Update translation terms from Transifex 2019-01-27 01:37:55 +01:00
Odoo Translation Bot 127fdea764 [I18N] Update translation terms from Transifex 2019-01-21 17:38:09 +01:00
Martin Trigaux 1e224d244c [I18N] export 12.0 source terms
Mostly following changes at 7f8631a913

closes odoo/odoo#30072
2019-01-15 15:15:34 +00:00
Swapnesh Shah 896ed33c77 [FIX] hr_holidays: Add missing parameters in method
closes odoo/odoo#30124
2019-01-10 18:09:01 +00:00
Nicolas Martinelli 023869970c [FIX] hr_holidays: days allocated
- Go to Leaves > Managers > All > Allocations
- Create an allocation for:
  Leave Type: Legal Leaves
  Mode: By Department
- Validate

When going to the Legal Leaves form view, the days allocated are not
shown.

This is because the domain is too restrictive. The allocation has a
`date_from` which is `False`, since it is only set for Accrual leaves.

We adapt the domain accordingly.

opw-1921338

closes odoo/odoo#30152
2019-01-11 14:58:16 +00:00
RomainLibert 8d6bb22298 [FIX] hr_holidays: use a better heuristic when mode != employee
closes odoo/odoo#30082
2019-01-09 15:50:14 +00:00
Jorge Pinna Puissant 5995680542 [FIX] hr_holidays: validation_type same behavior
opw-1919744

Before this commit, the user in the leave_type had the choice between
three validations : 'hr', 'manager' and 'both'. The behaviour of the
application was exactly the same if 'hr' or 'manager' was chosen.

In this commit, a computed field was added only to hide this choice,
and restrict the user to choice between the 'double validation'
or the normal validation.

This commit must be reverted once the fonctional part is implemented.

closes odoo/odoo#29952
2019-01-09 07:28:21 +00:00
Christophe Simonis 3e4138deaa [MERGE] forward port branch saas-11.3 up to 2d824a5b7a 2019-01-08 17:08:48 +01:00
Christophe Simonis b50883d17b [MERGE] forward port branch 11.0 up to c07b7200b2 2019-01-08 11:52:15 +01:00
Christophe Simonis c07b7200b2 [MERGE] forward port branch saas-15 up to e1c7fefe89 2019-01-07 18:19:25 +01:00
Christophe Simonis e1c7fefe89 [MERGE] forward port branch saas-14 up to cdb0c08cb9 2019-01-07 17:30:57 +01:00
Christophe Simonis cdb0c08cb9 [MERGE] forward port branch 10.0 up to d4024a713c 2019-01-07 17:30:11 +01:00
Odoo Translation Bot 652cecffde [I18N] Update translation terms from Transifex 2019-01-06 01:32:05 +01:00
Alexey Pelykh 1ffc485689 [FIX] hr_holidays: extra space in state check
The condition was never validated

closes odoo/odoo#29898
2019-01-04 10:18:30 +00:00
Odoo Translation Bot d331d28fdf [I18N] Update translation terms from Transifex 2019-01-06 03:24:31 +01:00
Martin Trigaux 838c9e5617 [I18N] export 11.0 source terms
To integrate recent content changes and benefit from cd4080839f and 7f8631a91

closes odoo/odoo#29933
2019-01-04 10:13:05 +00:00
Nicolas Lempereur a6279fe169 [FIX] hr_holidays: demo data error on 31 december
On installation demo data causes an error on 31 december since we test:
 is 31 december at midnight < now() => so after midnight error.

Solve this by comparing today instead of datetime.

opw-29776
closes #29830
2018-12-31 11:31:02 +00:00
Odoo Translation Bot 076c835544 [I18N] Update translation terms from Transifex 2019-01-01 02:42:55 +01:00
Odoo Translation Bot 5d237b2037 [I18N] Update translation terms from Transifex 2018-12-23 03:12:41 +01:00
Yannick Tivisse 0a3f8740f9 [FIX] hr_holidays: Correctly compute number_of_days on form loading
Backport of https://github.com/odoo/odoo/commit/1c391c3dfbdf733304fc882b9045d25e20e6dd1f

Closes #29800

closes odoo/odoo#29853
2019-01-02 15:40:51 +00:00
Swapnesh Shah ea301bef93 [FIX] hr_holidays: recompute the duration based on employee
When changing the employee value, the duration was not recomputed

closes odoo/odoo#29844
2019-01-02 15:16:52 +00:00
Nicolas Martinelli c9477b4cfd [FIX] hr_holidays: date and datetime comparison
The fields `validity_start` and `validity_stop` are `Date` fields, they
should therefore be compared to `datetime.date`.

opw-1918843

closes odoo/odoo#29834
2018-12-31 13:45:14 +00:00
Christophe Simonis a337b9ec92 [MERGE] forward port branch 12.0 up to f854e01a98 2019-01-18 14:26:33 +01:00
Martin Trigaux bfe1e20d6b [I18N] export saas-12.1 source terms
To reflect fixes at ec2263080a and cd4080839f

closes odoo/odoo#30253
2019-01-16 10:35:49 +00:00
Christophe Simonis 3cbc9dd6c0 [MERGE] forward port branch 12.0 up to 6a0675d36d 2019-01-14 10:34:50 +01:00
RomainLibert c76066402c [FIX] hr_holidays: add default filter on dashboard action
If you are holidays manager, you don't really want to see the leaves of
everybody, but are more interested in the leaves of the people you
manage and yours.

closes odoo/odoo#30066
2019-01-09 10:54:33 +00:00
Christophe Simonis 8aa8548d8a [MERGE] forward port branch 12.0 up to 3e4138deaa
closes odoo/odoo#30045
2019-01-09 15:56:53 +00:00
Martin Trigaux af69902ecc [I18N] export saas-12.1 source terms
closes odoo/odoo#29730
2018-12-24 11:07:31 +00:00
Odoo Translation Bot 91382f691d [I18N] Update translation terms from Transifex 2018-12-30 01:30:16 +01:00
Yannick Tivisse 4b22f1ff5e [FIX] hr_holidays: Reset interface-based fields on leave type change
Purpose
=======

When changing the leave type on a leave request, reset the technical
fields that only have a visual purpose to avoid mismatch on the leave
duration compute method.

closes odoo/odoo#29789
2018-12-28 11:30:29 +00:00
Yannick Tivisse 765075ff47 [FIX] hr_holidays: Fix 6035112
1/ self.date_from on a for loop on self won't work
2/ When calling get_work_hours_count with self.date_from=False or self.date_to=False,
   this will lead to a traceback when looking the timezone on the date.

Closes #29697
2018-12-28 11:24:41 +00:00
Yannick Tivisse 3b30f7ad05 [FIX] hr_holidays: Fix traceback on onchange
closes odoo/odoo#29773
2018-12-27 15:49:26 +00:00
Christophe Simonis f351dd8cab [MERGE] forward port branch 12.0 up to 047e2b28de 2018-12-12 11:38:25 +01:00
Odoo Translation Bot 77e7d952b4 [I18N] Update translation terms from Transifex 2018-12-09 03:15:09 +01:00
Odoo Translation Bot 47aae6faba [I18N] Update translation terms from Transifex 2018-12-23 01:29:13 +01:00