Thursday, August 1, 2024
2 changes · saas-17.2
Resolved issues and error corrections
This fixes an error that could interrupt users creating or editing appointment calendar events when the start or end date was removed. The appointment form now handles missing dates safely, avoiding disruptive tracebacks and improving reliability during scheduling.
Original PR description
Currently, a traceback occurs when the compute method triggers with recordsets having `resources_ids` and no `start` date. To reproduce this issue: 1) Install `appointment` 2) Open the `Gantt` view…
Currently, a traceback occurs when the compute method triggers with recordsets
having `resources_ids` and no `start` date.
To reproduce this issue:
1) Install `appointment`
2) Open the `Gantt` view of any `appointment type`
3) Click on any column of the `Gantt` view to create a new `calendar event`
4) Remove the `start` date
Error:
```
ValueError: Compute method failed to assign calendar.event(<NewId 0x7f585f8d91e0>,).on_leave_resource_ids
File "odoo/http.py", line 2248, in __call__
response = request._serve_db()
File "odoo/http.py", line 1823, in _serve_db
return self._transactioning(_serve_ir_http, readonly=ro)
File "odoo/http.py", line 1843, in _transactioning
return service_model.retrying(func, env=self.env)
File "odoo/service/model.py", line 134, in retrying
result = func()
File "odoo/http.py", line 1821, in _serve_ir_http
return self._serve_ir_http(rule, args)
File "odoo/http.py", line 1828, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "odoo/http.py", line 2053, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "odoo/addons/base/models/ir_http.py", line 220, in _dispatch
result = endpoint(**request.params)
File "odoo/http.py", line 756, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "addons/web/controllers/dataset.py", line 38, in call_kw
return self._call_kw(model, method, args, kwargs)
File "addons/web/controllers/dataset.py", line 34, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "odoo/api.py", line 458, in call_kw
result = getattr(recs, name)(*args, **kwargs)
File "addons/web/models/models.py", line 1011, in onchange
todo = [
File "addons/web/models/models.py", line 1014, in <listcomp>
if field_name not in done and snapshot0.has_changed(field_name)
File "addons/web/models/models.py", line 1128, in has_changed
return self[field_name].keys() != set(self.record[field_name]._ids) or any(
File "odoo/models.py", line 6610, in __getitem__
return self._fields[key].__get__(self, self.env.registry[self._name])
File "odoo/fields.py", line 2954, in __get__
return super().__get__(records, owner)
File "odoo/fields.py", line 1270, in __get__
raise ValueError(f"Compute method failed to assign {missing_recs}.{self.name}")
```
When the user removes the `start` date it triggers a compute method `_compute_on_leave_resource_ids`
in which both `self` and `resource_events` are equal when the recordset having `resource_id`.
Eliminating one from the other leads to an empty record.
Also, because of no `start` date, it fails to enter into the for loop to assign a value to the `on_leave_resource_ids`
https://github.com/odoo/enterprise/blob/e57706031390e4ee8ddd85873bef24c59b0e9404/appointment/models/calendar_event.py#L119-L130
Eventually, the compute method failed to assign the value for the `on_leave_resource_ids` field.
And `on_leave_resource_ids` is a `read-only` and `non-storable` field.
Which leads to a traceback when `missing_recs_ids` have a value from below lines
https://github.com/odoo/odoo/blob/006e35a6efd0c5ae4c122008261899a7cc76f693/odoo/fields.py#L1266-L1270
Note:- A `TypeError` also occurs when we removing the end date
After applying this commit, it will resolve this issue by assigning a value to the field.
sentry-5469275451This update fixes an issue in Point of Sale where certain exempt fields were incorrectly connected during loading. It helps prevent potential data handling problems and improves reliability when the POS starts up.
Original PR description
Before this commit, exempted fields were being connected upon loading, which could lead to issues. opw-4088809 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr