Tuesday, September 15, 2026
2 changes · saas-18.2
Resolved issues and error corrections
This fix prevents the Time Off application from crashing when an employee has more than one related contract. It ensures contract start dates are handled one by one, so users can open the app without interruption.
Original PR description
Description of the issue/feature this PR addresses:
selected_contract can have multiple contracts, with this fix, we cycle through to get .date_start, avoiding errors
Current behavior before PR:
when opened, the Time Off application throws the following error:
```
File "/home/odoo/src/odoo/addons/hr_contract/models/hr_employee.py", line 216, in _get_unusual_days
tmp_date_from = max(date_from_date, selected_contract.date_start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/odoo/src/odoo/odoo/fields.py", line 1232, in get
record.ensure_one()
File "/home/odoo/src/odoo/odoo/models.py", line 6269, in ensure_one
raise ValueError("Expected singleton: %s" % self)
```
Desired behavior after PR is merged:
No errors when opening the app
---
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-prCommission detail views now use the sales team from the selected commission plan instead of the salesperson's primary team. This prevents empty or misleading achievement details when a salesperson belongs to multiple teams, helping managers review the right sales performance data.
Original PR description
When a salesperson belongs to multiple sales teams, opening the details of a team-based commission plan can show an empty Achievement Details view if the plan's team differs from the salesperson's…
When a salesperson belongs to multiple sales teams, opening the details of a team-based commission plan can show an empty Achievement Details view if the plan's team differs from the salesperson's primary sales team. Steps to reproduce: - Create two sales teams, Team A and Team B, without assigning a team leader. - Add the same salesperson to both teams, with Team B added first, making Team B the salesperson's sale_team_id. - Create separate team-based commission plans for Team A and Team B and add the salesperson to both plans. - Create and confirm a sales order for Team A with the salesperson assigned. - Open the commission report for Team A and click Details. The Achievement Details view is empty, while Team B details load as expected. The action populates `commission_team_ids` using the salesperson's `sale_team_id` rather than the team associated with the commission plan being viewed. When building the achievement report, `commission_team_ids` is used to pre-filter sales orders and invoices in CTEs (`filtered_orders` and `filtered_moves`). Because the salesperson's `sale_team_id` is Team B, only Team B records pass the pre-filter. When these records are subsequently joined on the plan's team (`Team A`), no records match, resulting in an empty view. Use the commission plan's team when populating `commission_team_ids` so that the source records are filtered using the team associated with the selected plan. Teams where the user is a team leader are no longer added to the context, as the achievement report is scoped to the selected plan's team. opw-6529552