[16.0][FIX] server_action_mass_edit: Don't do onchange
This change was introduced unnoticed in the migration to 16.0 in #544, but it has several problems:
- The onchange is only executed for one record, not several, and this module is for mass actions.
- Not all the users want to play onchanges, being for one record or several.
Let's remove it for being consistent. An ongoing discussion for supporting onchanges through onchange_helper is meanwhile active.
@Tecnativa
@grindtildeath could you review this one, as you worked a lot on onchange topic ?
thanks !
Maybe @ramiadavid can give the reason of the change? Even if the code seems weird indeed.
Actually, I don't remember the reason for this, from the git history I understand that the change is mine, but I have no memory of having done this myself, it seems strange to me that I have made these changes in a migration because it is not even a module that let's use a lot.
Actually, I don't remember the reason for this, from the git history I understand that the change is mine, but I have no memory of having done this myself, it seems strange to me that I have made these changes in a migration because it is not even a module that let's use a lot.
Done there : https://github.com/OCA/server-ux/pull/544
And particularly there: https://github.com/OCA/server-ux/commit/617be5f65e8c30c509e24ab00cab30f9849ac5ac#diff-8d785e151e9ad076da0aff7904315bc3ca9dc70ad1fca741b35e07beced4198fR75
Hi, I tried and couldn't open the wizard
Here is the traceback
Traceback (most recent call last): File "/home/trobz/code/odoo/odoo/16.0/odoo/models.py", line 5349, in _update_cache field_values = [(fields[name], value) for name, value in values.items()] File "/home/trobz/code/odoo/odoo/16.0/odoo/models.py", line 5349, in
field_values = [(fields[name], value) for name, value in values.items()] KeyError: 'selection__country_id' During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/trobz/code/odoo/odoo/16.0/odoo/http.py", line 1653, in _serve_db return service_model.retrying(self._serve_ir_http, self.env) File "/home/trobz/code/odoo/odoo/16.0/odoo/service/model.py", line 133, in retrying result = func() File "/home/trobz/code/odoo/odoo/16.0/odoo/http.py", line 1680, in _serve_ir_http response = self.dispatcher.dispatch(rule.endpoint, args) File "/home/trobz/code/odoo/odoo/16.0/odoo/http.py", line 1884, in dispatch result = self.request.registry['ir.http']._dispatch(endpoint) File "/home/trobz/code/odoo/odoo/16.0/odoo/addons/base/models/ir_http.py", line 154, in _dispatch result = endpoint(**request.params) File "/home/trobz/code/odoo/odoo/16.0/odoo/http.py", line 734, in route_wrapper result = endpoint(self, *args, **params_ok) File "/home/trobz/code/odoo/odoo/16.0/addons/web/controllers/dataset.py", line 42, in call_kw return self._call_kw(model, method, args, kwargs) File "/home/trobz/code/odoo/odoo/16.0/addons/web/controllers/dataset.py", line 33, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/home/trobz/code/odoo/odoo/16.0/odoo/api.py", line 468, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/home/trobz/code/odoo/odoo/16.0/odoo/api.py", line 453, in _call_kw_multi result = method(recs, *args, **kwargs) File "/home/trobz/code/odoo/odoo/16.0/odoo/models.py", line 6582, in onchange record = self.new(initial_values, origin=self) File "/home/trobz/code/odoo/odoo/16.0/odoo/models.py", line 5781, in new record._update_cache(values, validate=False) File "/home/trobz/code/odoo/odoo/16.0/odoo/models.py", line 5351, in _update_cache raise ValueError("Invalid field %r on model %r" % (e.args[0], self._name)) ValueError: Invalid field 'selection__country_id' on model 'mass.editing.wizard'
The above server error caused the following client error: null
Hi, I tried and couldn't open the wizard
Here is the traceback
Traceback (most recent call last): File "/home/trobz/code/odoo/odoo/16.0/odoo/models.py", line 5349, in _update_cache field_values = [(fields[name], value) for name, value in values.items()] File "/home/trobz/code/odoo/odoo/16.0/odoo/models.py", line 5349, in field_values = [(fields[name], value) for name, value in values.items()] KeyError: 'selection__country_id' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/trobz/code/odoo/odoo/16.0/odoo/http.py", line 1653, in _serve_db return service_model.retrying(self._serve_ir_http, self.env) File "/home/trobz/code/odoo/odoo/16.0/odoo/service/model.py", line 133, in retrying result = func() File "/home/trobz/code/odoo/odoo/16.0/odoo/http.py", line 1680, in _serve_ir_http response = self.dispatcher.dispatch(rule.endpoint, args) File "/home/trobz/code/odoo/odoo/16.0/odoo/http.py", line 1884, in dispatch result = self.request.registry['ir.http']._dispatch(endpoint) File "/home/trobz/code/odoo/odoo/16.0/odoo/addons/base/models/ir_http.py", line 154, in _dispatch result = endpoint(**request.params) File "/home/trobz/code/odoo/odoo/16.0/odoo/http.py", line 734, in route_wrapper result = endpoint(self, *args, **params_ok) File "/home/trobz/code/odoo/odoo/16.0/addons/web/controllers/dataset.py", line 42, in call_kw return self._call_kw(model, method, args, kwargs) File "/home/trobz/code/odoo/odoo/16.0/addons/web/controllers/dataset.py", line 33, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/home/trobz/code/odoo/odoo/16.0/odoo/api.py", line 468, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/home/trobz/code/odoo/odoo/16.0/odoo/api.py", line 453, in _call_kw_multi result = method(recs, *args, **kwargs) File "/home/trobz/code/odoo/odoo/16.0/odoo/models.py", line 6582, in onchange record = self.new(initial_values, origin=self) File "/home/trobz/code/odoo/odoo/16.0/odoo/models.py", line 5781, in new record._update_cache(values, validate=False) File "/home/trobz/code/odoo/odoo/16.0/odoo/models.py", line 5351, in _update_cache raise ValueError("Invalid field %r on model %r" % (e.args[0], self._name)) ValueError: Invalid field 'selection__country_id' on model 'mass.editing.wizard' The above server error caused the following client error: null
When I remove these lines, it works. I guess they should be removed too, dont you think?
https://github.com/OCA/server-ux/blob/5c82c07d794b3f5942f1300982e571463e286d53/server_action_mass_edit/wizard/mass_editing_wizard.py#L91-L94
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.