Steps to reproduce issue:
1. Create two companies, **A** and **B**.
2. Create employee *X* in **A**.
3. Create a contract, assign it to *X* and change its state to Running.
4. Duplicate *X* to create employee *Y*
5. Change *Y*'s company to **B** (bypass warnings and errors).
6. Try to access Payroll Dashboard.
7. A Multi-Company access errors is raised
Explanation:
When duplicating *X*, the value from `contract_id` is copied to *Y*.
After *Y*'s company is changed to **B**, Payroll Dashboard tries to retrieve data from its `contract_id` and, the contract still being related to **A**, a Multi-Company access error occurs.
Suggested fix:
Preventing the value being copied solves the problem. It also lines up with the `contract_ids` not being copied.
The root issue existing in *v15.0*, the fix will be implemented in that version too.
opw-3623483
closesodoo/odoo#146890
X-original-commit: 703863d86c603a4cbbd6115713cd5d49e1887a22
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Stroobant Paul (stpa) <stpa@odoo.com>