Skip to Content
Menu
This question has been flagged
1 Atsakyti
7047 Rodiniai

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

Portretas
Atmesti
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


Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
0
lapkr. 23
7431
0
birž. 24
1324
1
rugp. 25
3526
3
liep. 25
6931
1
geg. 25
1120