Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
3833 Переглядів

I have a field "Operator"

I need to automatically populate it with the name of the user logged in

How do I do that ?

Thanks

Аватар
Відмінити
Найкраща відповідь

Hi  Adriano

Try

operator_id = fields.Many2one('res.users', 'Operator', default=lambda self: self.env.user, readonly=True)


Hope it helps,
Kiran K

Аватар
Відмінити
Найкраща відповідь

Hi,

you can find every table contains the following 4 fields:

create_uid,create_date,write_uid,write_date

you can display them just one line code easily in your XML file:





Hope it is useful.

Thanks.

Аватар
Відмінити

<field name="write_uid" string="UpdatedBy"/>
<field name="write_date" string="UpdatedDate"/>
<field name="create_uid" string="CreatedBy" />
<field name="create_date" string="CreatedDate"/>

Related Posts Відповіді Переглядів Дія
1
бер. 15
5040
2
серп. 24
1778
1
бер. 15
5549
1
бер. 15
8025
1
бер. 15
4949