跳至內容
選單
此問題已被標幟
1 回覆
3790 瀏覽次數

Hi !

I have tree objects A, A1 and A2.

A1 & A2 inherits A by delegation.

Is it possible to make a tree view of A in a way that when a user clicks on a row, it opens a form view of corresponding delegated objects A1 / A2 ?

頭像
捨棄
作者 最佳答案

Workaround: button in tree view with following function in model (assuming a1 and a2 are one2many fields):

@api.multi
def go_view(self):
self.ensure_one()
record = self.a1 if self.a1 else self.a2 if self.a2 else False
return {
'type': 'ir.actions.act_window',
'res_model': record._name,
'view_mode': 'form',
'view_id': self.env.ref('test.view_' + record._name + '_form').id,
'res_id': record.id,
}
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
9月 23
4724
2
7月 23
3151
2
6月 22
4074
0
9月 21
2264
0
9月 20
1773