Commit Graph
11 Commits
Author SHA1 Message Date
Thibault Libioulle 74624f43ee [REF] resource,hr{,_contract}: obtain calendar validity per resource
This commit adds methods to easily obtain calendar validity per resource
for a given search period and get the work intervals per resource,
taking into account the validity of their calendars.

In hr, the create and departure date of an employee are taken into
account to compute the calendars validity.

In hr_contract, it looks for every contract of human resources with
employee of type student or employee existing in the search period and
consider the specific calendar of the contract as valid during the
contract-lifetime.

PR: #77362

task-2646630
2021-11-30 12:20:47 +01:00
Raphael Collet 1398b6b44c [IMP] tests: deprecate SavepointCase
closes odoo/odoo#62031

Related: odoo/enterprise#14872
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-11-24 13:23:32 +00:00
Yannick Tivisse e28d0e02f1 [IMP] hr_contract: Convert tests to SavepointCase 2019-11-12 11:34:36 +00:00
Julien Castiaux 4f03a5f136 [FIX] *: remove old deprecated modules/functions
PEP-594 is deprecating a bunch of modules. As part of the cleanup, we
are also dealing with long deprecated modules, functions and aliases.

* `assert_` -> `assertTrue`
* `assertEquals` -> `assertEqual`
* `assertNotEquals` -> `assertNotEqual`
* `assertAlmostEquals` -> `assertAlmostEqual`
* `assertRaisesRegexp` -> `assertRaisesRegex`
* `assertRegexpMatches` -> `assertRegex`
* `base64.encodestring` -> `base64.encodebytes`
* `base64.decodestring` -> `base64.decodebytes`
* `inspect.getargspec` -> `inspect.signature`
* `inspect.formatargspec` -> `inspect.signature`
* `logging.warn` -> `logging.warning`

closes odoo/odoo#36863

Task: 2003936
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-17 11:36:42 +00:00
Kevin Baptiste f17655dd77 [IMP] hr_contract: Replace some contract states by kanban status
Purpose
=======

Having some usability check to be sure to make the pay
for everyone, and don't loose contracts.

We would like to remove incoming and to renew columns in
hr.contract and replace them by a kanban state.  In employee, we would
like to add warning on the kanban to warn the hr responsible there
is no contract or a contract is about to expire

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

hr.contract kanban:

- add a kanabn state
- it becomes red automatically when the contract is in running and  expire in 7 days
- add aquick search in filter to filter on expered soon
- the kanban state can be changed manaually (in case of there is several rh)
- sort by contract end date set first (more close of today first)

Employee kanban

- add an red icon if there is no contract in Runnig status OR there is a
kanban state red in their contract (whatever the status).
- add a quick seaach on employee with warning

- State pending + green = incoming
- State confirmed + red = about to expire / to renew

closes odoo/odoo#33489

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-06-28 06:59:32 +00:00
Lucas Lefèvre 22437e331a [IMP] hr_contract: Sync employee and contract calendars mismatch
Purpose
=======

An employee and its current contract should have the same
calendar. Currently, if the contract's calendar is changed,
the employee's calendar is not changed.
In the same way, if a contract is created directly in `open`
state, the employee's calendar is not changed.
Finally, the calendar synchronization when the employee
contract is changed is only done in payroll, for no reason.

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

Fix the three issues described above.

If the employee's calendar is nonetheless manually changed, a warning
should be displayed if there is a mismatch between both calendars.
2019-06-13 10:02:10 +02:00
Lucas Lefèvre 20bc2bbab5 [IMP] hr_payroll: add multi contract support
Purpose
=======

We would like to be able to manage multi contracts payslips and contract transitions.

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

General flow:
1/ Benefits are generated based on contracts's calendar.
2/ When validating additionnal benefits, calendar.attendances are created in the contract's calendar
3/ Create one payslip per contract in state [open|pending|close]
4/ For each payslip, generate worked day lines based on the contract's calendar

New Constraints:
1/ An employee cannot have more than one contract at the same time (excluding draft, closed and cancelled contracts).
2/ A leave cannot overlap multiple contracts.
3/ A contract cannot have starting and ending dates such that a leave become in the middle of
   two contacts.

New state for a contract: Incoming. It means it's ready and will be running soon.
An incoming contract automatically becomes 'Running' if the start date is passed (cron)

Number of hours and days are always correct (according to the contract's calendar) on payslips as the
flow starts from the contract's calendar.
However, it is not correct in the Time Off app because it's counted based on the employee's calendar.
The number of days/hours for hr.leaves should be computed according to
the contract at the time of the leave.
e.g. If I currently work full time and I request 2 weeks off next month where I'll be working only
3 days/week and 5hours/day (other contract), It should count 6 days and 30 hours.

- in hr.benefits form view show the contract (below employee field)

TaskID: 1903483

closes odoo/odoo#30181
2019-02-01 12:16:54 +00:00
Raphael Collet 2f7c03d9ca [IMP] base: add regular user admin as uid 2
User 1 simply becomes a technical user (inactive, no password).
2018-08-23 21:38:57 +02:00
Raphael Collet 960360afe4 [REF] *: use native date/datetime for Date/Datetime fields
From this commit onwards, Date fields will return datetime.date objects and Datetime fields will return datetime.datetime objects, this implies a number of things that are clearly explained both in the ORM API for master.

This commit also introduces a number of helper functions for dates and datetimes that are exposed in tools.date_utils and fields.Date[time], explained in the documentation as well.

Task-ID: 47189
2018-08-06 14:37:19 +02:00
Jeremy Kersten 88a25c0e87 [FIX] *: fix previous forward port 2017-08-31 00:14:37 +02:00
Jeremy Kersten 5d3cbf4d7a [FIX] hr_contract: fix auto pending/auto close
Before this commit, create a contract which expire in 2 months.
The cron will check all contracts that have a date_end >= tomorrow.
All contract with a end_date will be close.

Now we check all contracts that have a end_date <= yesterday and close it
2017-08-28 15:40:41 +02:00