Monday, May 13, 2024
2 changes · saas-17.1
Resolved issues and error corrections
Fixed an issue where opening the employee shortcut from a contact could crash after switching from a multi-company setup to a single company. The system now uses only the employee record for the active company, preventing confusion and keeping the contact screen usable.
Original PR description
This traceback occurs when the user clicks on the `employee` smart button. To reproduce this issue:- 1) Install `Employees`, `contacts` without demo data 2) Enter into `multi-company` environment by…
This traceback occurs when the user clicks on the `employee` smart button.
To reproduce this issue:-
1) Install `Employees`, `contacts` without demo data
2) Enter into `multi-company` environment by creating a new company
3) Now create a new `employee` with company as new company and
related `user` in the `Hr settings` as `Administrator`
4) Now switch to `single company` environment by disabling new company
5) click on the `employee` smart button from `contact` module for the
`Administrator` record
6) A traceback occurs
Error:-
```
ValueError: Expected singleton: hr.employee(1, 3)
```
Because after the commit `{1 }` from `saas-17.1`
when we have multiple records for a record in `multi-companies`
and shift to `single company`, the other company records are also `accessible`.
Because of that it leads to the above traceback when trying to access `id` from `self.employee_ids`
https://github.com/odoo/odoo/blob/4f9b67938032a8b253d930a70acd2283b30ecda6/addons/hr/models/res_partner.py#L30-L36
[1] https://github.com/odoo/odoo/pull/159210/commits/3c8e4496702a07d1f6e989882f69c3b93b82f663
After applying this commit will resolve this issue by filtering
the `employee_ids` based on the current company record `id`
sentry-5289238474The Point of Sale now loads only the pricing rules needed for products available in the session, instead of loading every pricelist item upfront. This improves opening performance for businesses with large pricing catalogs while still loading the right pricing data when additional products are added later.
Original PR description
Prior to this commit, the Point of Sale would load all product pricelist items upon session opening. This posed a problem in databases with a large number of pricelist items. This commit addresses the issue by only loading pricelist items corresponding to the loaded products. Additionally, for any products that are loaded into the PoS at a later time, their related pricelist items will be loaded as well. opw-3893700 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr