跳至內容
選單
此問題已被標幟
1 回覆
6981 瀏覽次數

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

頭像
捨棄
最佳答案

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


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
11月 23
7359
0
6月 24
1248
1
8月 25
3470
3
7月 25
6721
1
5月 25
1035