Daily updates from Odoo
Thursday, February 20, 2020
3 changes
Resolved issues and error corrections
This update removes unused selection settings from related fields across several Odoo apps and adds a warning to help prevent the issue from returning. It improves code quality and helps avoid confusing or incorrect field labels without changing core business workflows.
Original PR description
**Description of the issue/feature this PR addresses:** Some selection fields that are related have an explicit selection attribute that is not being used. Sometimes, those are just strings that don't have the "string=" part. This PR adds a logged warning to avoid this issue. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This fix makes error handling behave more consistently between standard web requests and JSON-based requests. It allows custom modules to handle JSON request errors in the same centralized way, reducing unexpected differences without materially changing normal behavior.
Original PR description
The idea is to make the dispatching and error-handling consistent for JsonRequest and HTTPRequest.
In 8809c77 we introduced a way for request-specific error-handling, but JsonRequest.dispatch() was still catching all errors internally, instead of letting them bubble up to ir_http._handle_exception()
By removing the internal try/except in JsonRequest.dispatch(), we do not
change the behavior much as there are only a couple of "ifs" in ir_http._handle_exception() before returning to the request-specific handle_exception. However we give the opportunity to modules to customize exception handling even for JsonRPC, the same way it is possible for HTTP requests.
Here is a simple pseudo code of the flow
```python
ir_http.dispatch():
try:
request.dispatch()
catch Exception as e:
ir_http._handle_exception(e)
```
```python
ir_http.handle_exception(e):
request._handle_exception(e)
```This update removes field options that were being ignored by the system because they do not apply to related fields. It helps keep payroll and timesheet configuration code cleaner without changing how users work with the system.
Original PR description
When a field is related, defining a selection or selection_add will have no effect and the attribute will be ignored. Enterprise part of odoo/odoo#45832 cc @MiquelRForgeFlow