How to get other model data using foreign key

I have 2 model which is linked via a foreign key.

For example:

class UserRegistration
age= fields.Text(‘Age’)

class RoomBooking
user= fields.Many2One(‘user.registration’, ‘User’)

I want to display the user age in RoomBooking tree, is there any way to do so?
I tried something like <tree><field name="user.age" /></tree> but error…
Thank you.

You should create a function field “age” in your RoomBooking class with an “on_change_with”

See example here with company field:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.