Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4 Odpowiedzi
2421 Widoki

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')

Awatar
Odrzuć

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

Autor

yes I have. but could not get the value.

Autor

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?

Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
mar 23
2405
0
gru 22
3035
0
cze 21
2977
0
cze 20
5468
1
lis 19
2789