Skip to content

Commit

Permalink
[FIX] server_action_mass_edit: Don't do onchange
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pedrobaeza committed Dec 19, 2024
1 parent f2a7499 commit 5c82c07
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions server_action_mass_edit/wizard/mass_editing_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,6 @@ def default_get(self, fields, active_ids=None):
res["selection__" + field.name] = "ignore"
return res

def onchange(self, values, field_name, field_onchange):
server_action_id = self.env.context.get("server_action_id")
server_action = self.env["ir.actions.server"].sudo().browse(server_action_id)
if not server_action:
return super().onchange(values, field_name, field_onchange)
dynamic_fields = {}
for line in server_action.mapped("mass_edit_line_ids"):
dynamic_fields["selection__" + line.field_id.name] = fields.Selection(
[()], default="ignore"
)
self._fields.update(dynamic_fields)
res = super().onchange(values, field_name, field_onchange)
for field in dynamic_fields:
self._fields.pop(field)
return res

@api.model
def _prepare_fields(self, line, field, field_info):
result = {}
Expand Down

0 comments on commit 5c82c07

Please sign in to comment.