Commit Graph
20 Commits
Author SHA1 Message Date
Samuel Degueldre 5c78793a75 [FIX] hr_holidays: fix crash in mail_partner_format
We were trying to sort a list of date with potentially falsy elements in
the list, causing a crash while trying to compare a date object with a
bool. This commit just makes the check that all dates are not falsy
before attempting to sort.

closes odoo/odoo#77012

X-original-commit: 6bd2a86e37809b4d77aad4597e926e99f9d2b2ce
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
2021-09-23 07:17:52 +00:00
Yannick Tivisse d12808bb9f [FIX] hr_holidays: Split existing leaves for company leaves
Purpose
=======

Currently, when setting a global leave for a company, the
leave validation raises an UserError if there is already a
leave on those dates.

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

Manage the conflicts for easy tests cases:
- The global time off is taken in days
- The conflicting leaves are all in days/half days

For those use cases, refuse all the conflicting leaves
and recreate other one before and/or after the global time
off, according to the use case.

Taskid: 2230549
X-original-commit: 20ef422fea7793fc87dbf51c43699bb7872036f9
2020-04-08 16:02:08 +00:00
Lucas Lefèvre 8f3a5068ca [IMP] hr_holidays: Add specific approval for allocations
Purpose
=======

We want to allow different approvals for allocations and leaves of a same type.

e.g. In case of compensation days, a manager would approve the
allocation request, but would later not approve leave requests.

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

Allocation modes
----------------
No change here except renames.
1. No limit (employee doesn't need an allocation to request a leave)
2. Allow employee requests
3. Fixed by Time Off Officer

Allocation approval
-------------------
A radio field to choose the approval mechanism
appears if the employee is allowed to request an allocation.
The following approval modes are possible:
1. Time Off Officer
2. Employee's Time Off Manager (leave_responsible_id)
3. Employee's Time Off Manager and Time Off Officer

These options are the same as leave approval options
(except the missing "No Validation").

If option 1 or 2 is selected, a o2m field should
allow to select which Time Off Officer is responsible
for approving those allocations.

Allocation approval policy is the same as the leave approval policy.

Task id: 1936742

Access rights based on task 1950998
2019-11-22 16:58:38 +01:00
Christophe Simonis 9bf0b04adb [MERGE] forward port branch 12.0 up to 82a8cdd6f2 2019-09-06 17:52:48 +02:00
RomainLibert c7f11aae6e [FIX] hr_holidays: aggregate attendances using day_period and dayofweek
Before this commit, if you had defined multiple attendances for the
morning or for the afternoon, the system would only use the first
attendance defined for either morning or afternoon.

This lead to wrong computations of the real leave length.

This commit fixes this issue by getting the min(hour_from) and
max(hour_to) for the attendances using a read_group.

closes odoo/odoo#36413

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-09-04 11:36:04 +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 6faad524cf [MERGE] forward port branch 12.0 up to bc744a1da4 2018-11-16 19:30:20 +01:00
jbm-odoo 662657f44b [IMP] hr_holidays: Re-introduce complete tests suite
The tests have been detroyed while merging a refactoring for 12.0.

This commit reintroduces unit tests to checks each business cases from
"The Flow" into python tests.

closes odoo/odoo#28323
2018-11-15 15:24:58 +00:00
lul-odoo 584211b1c9 [IMP] hr_holidays: Update department on upcoming validated leaves
Purpose
=======

Currently if a department is modified on an employee, the department is
modified accordingly on the leave request if it still in 'draft' or
'to submit' states.

This should also be the case for confirmed leaves, if it is still planned
in the future.

Note: A test has been added for this specific use case.

TaskID: 1882544

closes odoo/odoo#27661
2018-10-19 08:04:51 +00:00
Christophe Simonis 49c3264ce0 [MERGE] forward port branch saas-11.3 up to 4850fb0838 2018-09-07 14:43:48 +02:00
Thibault Delavallée 0f3281e3b1 [REF] hr_holidays: clean leave and allocation access rights
Purpose

 - clean access rights;
 - solve some access and security issues;

Access specifications

 - an user
  - can see all leaves;
  - cannot see name field of leaves belonging to other user as it may contain
    private information that we don't want to share to other people than
    HR people;
  - can modify only its own not validated leaves (except writing on state to
    avoid bypassing validation);
  - can discuss on its leave requests;
 - an Officer
  - can see all leaves;
  - can validate "HR" single validation leaves from people if
   - he is the employee manager;
   - he is the department manager;
   - he is member of the same department;
   - target employee has no manager and no department manager;
  - can validate "Manager" single validation leaves from people if
   - he is the employee manager;
   - he is the department manager;
   - target employee has no manager and no department manager;
  - can first validate "Both" double validation leaves from people like "HR"
    single validation, moving the leaves to validate1 state;
  - cannot validate its own leaves;
 - a Manager
  - can do everything he wants

In top of that, multi company rule are correctly added.

In reporting model using in "summary" name field should also be stripped
if you are not an HR officer and if it is not your own request.

Concerning allocation requests: implement same rules except constraint on
name field as it is less private and therefore can be seen.

This commit is linked to task ID 1876795 and PR #26656.
2018-08-31 14:19:23 +02:00
RomainLibert a8aa0bcbbe [IMP] hr_holidays: add accrual allocations support
We need to support the accrual allocation for leaves.
This is a special type of allocations that adds some leaves to the
allocation every X amount of time worked.

This kind of allocations is especially used in the USA, but can also be
used in other contexts (eg: In Belgium we could allocate 20 days per
year for the legal leaves)

These allocations have support for :

  * A max balance limit
  * Going in negative (if set on the leave_type and the manager
    approves the leaves)
  * Removing the unpaid leaves from the quantity of days worked
  * Setting an end date after which it does not allocate anymore leaves

Task #46114
Closes #22292
2018-06-08 14:41:05 +02:00
RomainLibert 05bb9848a2 [IMP] resource: add time_type field on resource.calendar.leaves
We would like to have an overview of project forecast that include
leaves, for this we need to implement several kind of 'leaves' directly
in resource module.

These kind of 'leaves' can be defined via the hr.leave.type model (only
visible in base.group_no_one (choices currently are 'leave' and 'other')

    * Add field time_type on resource.calendar.leaves
    * Add a domain restriction that allows for filtering on this field
    * Add tests
2018-02-19 10:43:25 +01:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
Denis Vermylen (dve) 6a8e4c6119 [REF] hr_holidays: replace workflow by python code 2016-09-02 10:16:49 +02:00
Olivier Dony 0bd4545348 [LEGAL] Use global LICENSE/COPYRIGHT files, remove boilerplate text
- Preserved explicit 3rd-party copyright notices
- Explicit boilerplate should not be necessary - copyright law applies
  automatically in all countries thanks to Berne Convention + WTO rules,
  and a reference to the applicable license is clear enough.
2015-06-02 03:16:04 +02:00
Christophe Simonis 18e22be138 [MERGE] forward port of branch 8.0 up to 0aab81c 2015-01-19 17:15:56 +01:00
Xavier Morel 65cd4a2a33 [FIX] remove deprecated checks/fast_suite test attributes from standard modules 2015-01-15 14:31:40 +01:00
Leonardo Donelli 4a0b13ed92 [REF] remove vim modelines and resulting trailing blank lines
Let 2015 be a year without modelines!
cf #4174
2014-12-31 15:52:13 +01:00
Thibault Delavallée 08b0784e76 [IMP] hr_holidays:
- added a workflow transition from refuse to draft, to allow resetting
a refused request
- resetting is now based on a can_reset field, taht is based on whether
it is my own request or I am an hr manager
- added an access right on crm_meeting that was preventing hr officers
to validate some requests
- improved form view to show reset to draft button accordingly
- added tests that helped trigerred the various bugs and improvements

bzr revid: tde@openerp.com-20130809144752-o21pjbc56o0t8fym
2013-08-09 16:47:52 +02:00