YamK
YamK

Reputation: 73

Odoo v10: How to display the email of the current logged in user in a form?

In order to get current session user id we use: request.session.uid.

For example in an input type it's like this:

<input type="text" class="form-control form-control-lg" name="current_user_id" readonly="1" t-att-value="request.session.uid"></input>

But how to get the email address instead of id?

Upvotes: 1

Views: 740

Answers (1)

Veikko
Veikko

Reputation: 3610

You can find the current user in request.env.user object and refer to users's email field like this:

<input type="text" class="form-control form-control-lg" name="current_user_email" readonly="1" t-att-value="request.env.user.email"></input>

Br,

Veikko

Upvotes: 1

Related Questions