コンテンツへスキップ
メニュー
この質問にフラグが付けられました
4 返信
2467 ビュー

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

アバター
破棄
関連投稿 返信 ビュー 活動
1
3月 23
2452
0
12月 22
3098
0
6月 21
3009
0
6月 20
5519
1
11月 19
2806