Thursday, January 16, 2025
2 changes · saas-17.4
Resolved issues and error corrections
Work centers now show only the working calendars that belong to the user's current company. This prevents users from accidentally selecting calendars from other companies, reducing confusion in multi-company manufacturing setups.
Original PR description
Steps to reproduce the bug: - Create a workcenter: Problem: All the resource calendar from all the companies are displayed. opw-4478393
This fix ensures Belgian payroll demo holidays are assigned to the Belgian company instead of the main company. It prevents demo data from interfering with scheduling and payroll-related tests or behavior in multi-company setups.
Original PR description
In this FW-port https://github.com/odoo/enterprise/pull/74528 we are having a test failing when checking I found out that it is failing because demo data of payroll belgian localization as it is…
In this FW-port https://github.com/odoo/enterprise/pull/74528 we are having a test failing when checking I found out that it is failing because demo data of payroll belgian localization as it is creating a public holiday which affects the working dates of the test 'test_move_backward_without_conflicts'. This public holiday https://github.com/odoo/enterprise/blob/c16044ce583fd2caf9210ab2621e2bcd55be4421/l10n_be_hr_payroll/data/l10n_be_hr_payroll_demo.xml#L29-L35 should be only for the belgian company but since company_id field in 'resource.calendar.leaves' is readonly and computed so it is not protected while creation https://github.com/odoo/odoo/blob/0506eb85a3f6717117110bed53c4397e25672dc5/odoo/models.py#L4780-L4781 at some point it is getting changed to the main company id when computing the company_id in resource.calendar.leave since we don't have a calendar_id https://github.com/odoo/odoo/blob/d8fa043f085ee1e1d11708e2bd1213b7ce3c9dd9/addons/resource/models/resource_calendar_leaves.py#L59-L61 To fix this while computing the company_id we are now checking if the company_id is not set as if it is already has a value we will not override it and we fallback on the resource_id.company_id before we get the self.env.company