Hi.
I have the following code (simplied):
class Wizard(models.TransietModel):
_name = 'module.wizard'
wizard_lines = fields.One2many('module.wizard.lines', 'wizard_id')
@api.model
def default_get(self, fields):
rec = super(Wizard, self).default_get(fields)
wizard_lines = []
users = self.env['res.users'].search([])
for user in users:
wizard_lines.append((0, 0, {'user_id': user.id})
rec.update({'wizard_lines': wizard_lines})
return rec
class WizardLine(models.TransientModel):
_name = 'module.wizard.lines'
wizard_id = fields.Many2one('module.wizard')
user_id = fields.Many2one('res.users')
somefield = fields.Char(compute='_compute_somefield')
@api.depends('user_id')
def _compute_somefield(self):
for rec in self:
rec.somefield = 'This is a example ' + rec.user.email
def button_function(self):
#get ldap values for line and update users record
The problem is, that the _compute_somefield function does not get called and that the button function seems to be unable to access the user_id subfields. id did a combination of onchange and compute instead of the default_get but it was kind of hackish but did work. this much cleaner approach does not work however. am i using default_get wrong somehow?