Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
6974 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
lis 23
7358
0
cze 24
1248
1
sie 25
3463
3
lip 25
6709
1
maj 25
1022