# -*- coding: utf-8 -*- from odoo import models, fields, api class ChangeEmployeeWizard(models.TransientModel): _name = 'change.employee.wizard' _description = 'Change Employee Wizard' model_name = fields.Char(string='Model Name', required=True) field_name = fields.Char(string='Field Name', required=True) user_id = fields.Many2one('res.users', string='New Employee', required=True) def action_change_employee(self): """Change employee for selected records""" self.ensure_one() # Get active records active_model = self._context.get('active_model') active_ids = self._context.get('active_ids') if active_model and active_ids: records = self.env[active_model].browse(active_ids) # Update field on all selected records records.write({self.field_name: self.user_id.id}) return { 'type': 'ir.actions.client', 'tag': 'display_notification', 'params': { 'title': 'Employee Updated', 'message': f'{len(records)} records updated with new employee: {self.user_id.name}', 'type': 'success', 'sticky': False, } }