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

I have a transient model defined.

I want one of its fields defined using active_id from context.

I want to use new API.

Does anyone know how to do it? Thanks

頭像
捨棄
最佳答案

Hello EM,


@api.model

 def default_get(self, fields):

    rec = super(TransientModelClass, self).default_get(fields)

    class_obj = self.env['class.name'].browse(self._context.get('active_id'))

    for variable in class_obj:

        rec['wizard_field'] = variable.class_field


Hope this will helps you.

Thanks,


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
8月 19
12719
2
2月 22
5519
3
2月 24
11612
2
9月 15
4589
0
5月 15
3093