Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] server_action_mass_edit: Don't do onchange #984

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

pedrobaeza
Copy link
Member

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

This change was introduced unnoticed in the migration to 16.0 in OCA#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.
@pedrobaeza pedrobaeza added this to the 16.0 milestone Dec 19, 2024
@legalsylvain
Copy link
Contributor

@grindtildeath could you review this one, as you worked a lot on onchange topic ?

thanks !

Copy link
Contributor

@grindtildeath grindtildeath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this override is meant to do, but it is not working anyway 🙄

@rousseldenis
Copy link
Contributor

Maybe @ramiadavid can give the reason of the change? Even if the code seems weird indeed.

@ramiadavid
Copy link
Contributor

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.

@rousseldenis
Copy link
Contributor

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 : #544

And particularly there: 617be5f#diff-8d785e151e9ad076da0aff7904315bc3ca9dc70ad1fca741b35e07beced4198fR75

@trisdoan
Copy link

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

@trisdoan
Copy link

trisdoan commented Dec 24, 2024

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?

for line in server_action.mapped("mass_edit_line_ids"):
field = line.field_id
fields.append("selection__" + field.name)
res["selection__" + field.name] = "ignore"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants