Wednesday, April 17, 2024
7 changes · 17.0
Enhancements to existing features
The system now uses more precise targeting to locate the fiscal position field in invoice forms, making the code more reliable and easier to maintain. This change fixes compatibility issues with customizations while improving how the system identifies and modifies form fields.
Original PR description
Currently, an inherited view for `account.view_move_form` targets field `fiscal_position_id` directly with an xpath. While that works for standard modules, it is a very broad xpath that only succeeds in selecting the correct field because it appears before other ocurrences of identically named fields. This commit narrows down the xpath to make it explicit that we target the field located in `account.move`'s "Other Info" page. This fixes an ongoing issue with a customization (described in the task) while improving readability and extensability of `account_invoice_form_inherit`. Task link: [odoo/task#3837027](https://www.odoo.com/web#model=project.task&id=3837027) Task-3837027 Forward-Port-Of: odoo/enterprise#60358
This update improves the documentation and testing of the throttleForAnimation function to help developers understand how to properly handle browser events that lose their context during asynchronous operations. The change includes better guidance and test cases showing how to track scroll event targets in Chrome, preventing potential issues when animations are throttled.
Original PR description
This is a followup on [1]. In Chrome the event's currentTarget is cleared after events such as "scroll" are handled. For asynchronously called methods to be able to access it, the current value of currentTarget needs to be kept. To help developers that might stumble on this issue when using `throttleForAnimation`, this commit emphasizes the fact that usage of that function is not limited to event handlers, and it adds a test case that illustrates a solution for tracking the lost scroll event target. No scenario was identified in 15.0, but this could be used as an alternative solution for [1]. [1]: https://github.com/odoo/odoo/commit/0ba601d2ef5c4e2f846818e78dcd23966d6f563d task-3449843 Forward-Port-Of: odoo/odoo#160969 Forward-Port-Of: odoo/odoo#131259
Resolved issues and error corrections
This fix prevents Point of Sale settings from crashing when a user changes available pricelists while a POS session is already open in another tab. It improves reliability for store managers configuring POS without interrupting active sales sessions.
Original PR description
Currently traceback is occurring in sentry when the user tries to modify the `avilable_pricelist_id` when the session is open. steps to produce:- 1) Install `POS` 2) open POS and duplicate the tab 3)…
Currently traceback is occurring in sentry when the user tries to modify the `avilable_pricelist_id`
when the session is open.
steps to produce:-
1) Install `POS`
2) open POS and duplicate the tab
3) In the first tab open the settings of POS from the configuration
4) In another tab open a session from the POS dashboard
5) Now in the first tab save the record by applying some changes
6) Traceback occurs
Traceback in sentry:
```
IndexError: list index out of range
File "odoo/http.py", line 2251, in __call__
response = request._serve_db()
File "odoo/http.py", line 1826, in _serve_db
return self._transactioning(_serve_ir_http, readonly=ro)
File "odoo/http.py", line 1847, 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 1824, in _serve_ir_http
return self._serve_ir_http(rule, args)
File "odoo/http.py", line 1832, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "odoo/http.py", line 2057, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "odoo/addons/base/models/ir_http.py", line 222, in _dispatch
result = endpoint(**request.params)
File "odoo/http.py", line 740, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "addons/web/controllers/dataset.py", line 34, in call_kw
return self._call_kw(model, method, args, kwargs)
File "addons/web/controllers/dataset.py", line 30, 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 74, in web_save
self = self.create(vals)
File "<decorator-gen-308>", line 2, in create
File "odoo/api.py", line 420, in _model_create_multi
return create(self, [arg])
File "addons/point_of_sale/models/res_config_settings.py", line 155, in create
pos_config.with_context(from_settings_view=True).write(pos_fields_vals)
File "addons/point_of_sale/models/pos_config.py", line 433, in write
removed_pricelist = set(self.available_pricelist_ids.ids) - set(vals[key][0][2])
```
After applying this commit will resolve this issue by making the code robust with an extra check
of the `avilable_pricelist_id` value in vals.
sentry-4630816379This fix prevents internal technical field labels from being included in exported data for project and timesheet-related records. It reduces clutter and confusion for users who rely on exports for reporting or business review.
Original PR description
Task-3631801
This update removes outdated code from the IoT module that was generating warning messages in system logs. The change replaces an older method for checking if required libraries are available with a newer, recommended approach. This cleanup helps maintain system stability and keeps the codebase current with Odoo's latest standards.
Original PR description
Currently, iot module uses `get_resource_path` to check whether a Worldline libeasyctep.so library is present on the IoT Box. It is currently provoking a deprecation warning in logs: ``` 2024-04-16…
Currently, iot module uses `get_resource_path` to check whether a Worldline libeasyctep.so library is present on the IoT Box.
It is currently provoking a deprecation warning in logs:
```
2024-04-16 09:34:02,574 2873 WARNING ? py.warnings: /home/pi/odoo/odoo/modules/module.py:167: DeprecationWarning: Since 17.0: use tools.misc.file_path instead of get_resource_path(hw_driver>
File "/usr/lib/python3.11/threading.py", line 995, in _bootstrap
self._bootstrap_inner()
File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/home/pi/odoo/addons/hw_drivers/main.py", line 106, in run
helpers.load_iot_handlers()
File "/home/pi/odoo/addons/hw_drivers/tools/helpers.py", line 400, in load_iot_handlers
spec.loader.exec_module(module)
File "/home/pi/odoo/addons/hw_drivers/iot_handlers/interfaces/CTEPInterface_L.py", line 15, in <module>
if not get_resource_path("hw_drivers", "iot_handlers", "lib", "ctep", "libeasyctep.so"):
File "/home/pi/odoo/odoo/modules/module.py", line 167, in get_resource_path
warnings.warn(
```
Since `get_resource_path` is deprecated as of v17.0, this PR replaces it by `file_path` to remain up to date.
Apart from replacing the deprecated `get_resource_path`, this PR also replaces `subprocess.check_call` by the `subprocess.run` in the corresponding code as suggested by subprocess documentation starting from Python v3.5
Finally, it prettifies the modified lines of code a little by changing a variable name and modifying the logger message in case of an error to make it more specific
task-3872853Portal users will now receive a clear notification message when they try to open embedded views in Knowledge articles, informing them that only internal team members can access this feature. This prevents confusion and improves the user experience by explaining why the view cannot be opened.
Original PR description
**Steps to reproduce:** 1) Open any view of any module. 2) Click on insert a link in the article from Favorites. 3) Now publish the article from the share panel. 4) Copy that link and open it from the portal user. 5) Click on the embedded link(if only read access), double click on it(if write access). **Solution:** Notify the portal user with a toaster notification that only internal members can open that view. **Task**-3082042 Forward-Port-Of: odoo/enterprise#57347
This fix removes unnecessary and non-functional border width size options (small and large) from the website theme editor's input field styling controls. These options were displaying empty and serving no purpose, so they have been cleaned up to simplify the user interface and reduce confusion when customizing website themes.
Original PR description
Steps to reproduce : 1. click on edit website. 2. click on THEME tab from snippet options. 3. scroll down to input fields. 4. the border width has options for small and large size, which serves no purpose and were displayed empty. Purpose: This PR aims to remove the changes made on [[1]](https://github.com/odoo-dev/odoo/commit/6c0d2da07d2df2a27155678f58a6ffc79351e543) which added 2 sub-levels options for Border Width for Input Field which served no purpose. After this PR : The Border Width option will not have sub options small and large. task-3771146 Forward-Port-Of: odoo/odoo#157374