# How to show the name of 3rd ref class in UI?

**URL:** <https://discuss.tryton.org/t/how-to-show-the-name-of-3rd-ref-class-in-ui/8793>\
**Category:** Developer\
**Created:** [August 25, 2025, 9:47am UTC](https://discuss.tryton.org/t/how-to-show-the-name-of-3rd-ref-class-in-ui/8793 "2025-08-25T09:47:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bromoapp](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/b/71c47a/32.png) [@bromoapp](https://discuss.tryton.org/u/bromoapp)\
**Post date:** [August 25, 2025, 9:47am UTC](https://discuss.tryton.org/t/how-to-show-the-name-of-3rd-ref-class-in-ui/8793/1 "2025-08-25T09:47:59Z")

</div>

I have 3 level of class dependency, the 1st is ( **Staff** ) below:

```auto
class Staff(ModelSQL, ModelView):
    'Staff'
    __name__ = 'ltl.staff'
    _rec_name = 'name'

    name = fields.Char('Name', required=True)
    gender = fields.Selection([
        (None, 'Select..'),
        ('Male', 'Male'),
        ('Female', 'Female')
    ], 'Gender')

```

This **Staff** class is called from the 2nd class ( **EmploymentStaff** ) as below:

```auto
class EmploymentStaff(ModelSQL, ModelView):
    'Staff'
    __name__ = 'ltl.employment.staff'
    _rec_name = 'staff.name'

    staff = fields.Many2One('ltl.staff', 'Employee', required=True)

    role = fields.Selection('get_roles', 'Position', sort=False, required=True)

```

This **EmploymentStaff** is called from the 3rd class ( **ProjectMember** ) as below:

```auto
class ProjectMember(ModelSQL, ModelView):
    'Project Member'
    __name__ = 'ltl.project.member'
    _rec_name = 'member.staff'

    project = fields.Many2One('ltl.project', 'Project', required=True)

    member = fields.Many2One('ltl.employment.staff', 'Member', required=True)

```

I try to render the **name** of the staff in **ProjectMember** list UI, but I got **ProjectMember ID** instead, see below screenshot:

 ![image](https://discuss-cdn.tryton.org/uploads/default/original/2X/4/460699d08cecf049f31b1a2fa203ca273e6100f6.png)

How to render the staff’s name.. if the real object is at 3rd level?

**Note:** in the **EmploymentStaff** list UI, I can show the staff’s name.. this problem only appears on the 3rd level call

Bromo

---

<div class="post-metadata">

**Author:** ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)\
**Post date:** [August 25, 2025, 10:43am UTC](https://discuss.tryton.org/t/how-to-show-the-name-of-3rd-ref-class-in-ui/8793/2 "2025-08-25T10:43:33Z")

</div>

It is not possible to use dot notation int the `_rec_name` attribute as you did here:

> [@bromoapp](#):
>
> `_rec_name = 'staff.name'`

As tryton does not find a field which such name it just shows the ID.

You should override the `get_rec_name` function to return the text you want.

In your case, if you want to show the rec\_name of the staff it should be something like this:

```python
def get_rec_name(self, name):
    return self.staff.rec_name

```

---

<div class="post-metadata">

**Author:** ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)\
**Post date:** [August 26, 2025, 10:43am UTC](https://discuss.tryton.org/t/how-to-show-the-name-of-3rd-ref-class-in-ui/8793/3 "2025-08-26T10:43:57Z")

</div>

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