Skip to Content
Menú
This question has been flagged
1 Respondre
7002 Vistes

class RUModifier(models.Model):
    _inherit = "res.users"
    __uid_cache = defaultdict(dict)
    #override
    @api.multi
    def write(self, values):
        .......

        ......

        employee = self.env['hr.employee'].search([('id', '=', self.employee_ids.id)])
        employee.sudo().write(values)
        return res

Settings -> Users & Companies -> Users

I click "inactive" -> Active, i don't get employeer ID?

How to get it?

Thanks

Avatar
Descartar
Best Answer

while you activate or inactive a record, the function toggle_active is triggered. so you must override the same and do the needful. here is an example.


@api.multi
def toggle_active(self):
""" Inverse the value of the field ``active`` on the records in ``self``. """
# try to get he employee with related field user_id of hr.employee


Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
de nov. 23
7389
0
de juny 24
1276
1
d’ag. 25
3490
3
de jul. 25
6770
1
de maig 25
1070