Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
6980 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
0
Nov 23
7359
0
Jun 24
1248
1
Agu 25
3470
3
Jul 25
6721
1
Mei 25
1034