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

How Get A Current Login User Name in Textbox when Any Form Load time?

頭像
捨棄
最佳答案

In the default method Get User Name

    def _get_user_name(self, cr, uid, *args):
        user_obj = self.pool.get('res.users')
        user_value = user_obj.browse(cr, uid, uid)
        return user_value.login or False

  _defaults = {   
        'user_id: _get_user_name,
        }
頭像
捨棄

Thanks Prakash! This has helped me a lot :) Upvoted.

最佳答案
define user_id as many2one (res.users)


_defaults = { 'user_id': lambda obj, cr, uid, ctx=None: uid,}
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
4月 23
23209
1
3月 15
6945
3
3月 15
7013
0
3月 15
5753
2
9月 15
10648