Files
odoo_source/addons/hr_contract
alt-odoo 0053a9e565 [FIX] hr_contract: handle employees with multiple contracts
In case an employee has multiple contracts in several companies, we need
to only keep the contract of the current company of the employee, as
there can be only one in the main view hr_contract_history.

Before this patch, contract_information CTE returns the same ID for both
contracts:
employee_id | company_id | id | is_under_contract
-------------+------------+--------+-------------------
681 | 1 | 146842 | 0
681 | 14 | 146842 | 0

After the patch, it returns:
employee_id | company_id | id | is_under_contract
-------------+------------+--------+-------------------
681 | 1 | 4009 | 0
681 | 14 | 146842 | 0

We need to fix the WINDOW clause to make sure the id of the contract
that is selected is the one in the same company as the employee/contract
being selected in the contract_information CTE.

This way when an employee has multiple contracts, there will still be
1 line for each contract, but each with a different contract ID.

closes odoo/odoo#102821

X-original-commit: 88fa430be8a0c164e100b5f3c2f16ae906cc9a54
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Alex Thuyls (alt) <alt@odoo.com>
2022-10-10 11:57:16 +02:00
..
…
2022-09-20 13:48:49 +02:00
2022-10-06 22:22:42 +02:00