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

I have 3 classes. How can i access the title from model.a from the model.c?

class A(models.Model)

_name= 'mode.a'

title = fields.Text()

b_ids = fields.One2many('model.b', 'a_ids')


class B(models.Model)

_name= 'model.b'

a_id = fields.Many2one('model.a')

c_ids = fields.One2Many('mode.c','b_id')


class C(models.Model)

_name = 'model.c'

b_id = fields.Many2one('model.b')

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

Have you tried this? `self.b_id.a_id.title`

Автор

yes I have. but could not get the value.

Автор

it works as you said Kabeer, but the problem is that, I can see the title in the form view. After saving the title appears. is there any solutions?

Найкраща відповідь

If the title disappears you'll try to set 'Store = True' on the field (if it's a computed field).

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
бер. 23
2468
0
груд. 22
3110
0
черв. 21
3018
0
черв. 20
5528
One2many or many2one Вирішено
1
лист. 19
2809