Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
8916 มุมมอง

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,


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
default_get in the new API, how? แก้ไขแล้ว
2
ส.ค. 19
12740
2
ก.พ. 22
5528
3
ก.พ. 24
11626
api.onchange v8 doesnt work แก้ไขแล้ว
2
ก.ย. 15
4605
0
พ.ค. 15
3100