Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
6978 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
nov 23
7358
0
giu 24
1248
1
ago 25
3466
3
lug 25
6710
1
mag 25
1023