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

I am trying to create a dynamic view which will create a checkbox for each element of the categories table which in created by the categories() class in my module.py file.

Now inside my users() class I created the function fields_view_get with the following code

def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
    result = super(categories, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
    school_obj = self.pool.get('sim.categories')
    result['arch'] = '''<field name="father_name" />'''
    return result

As you can see my code is not even close to generating the dynamic fields, I am still far away of doing that but even this test gives me the following error

TypeError: super(type, obj): obj must be an instance or subtype of type

I figured out that if I change categories in the result = ... line for users the error will go away giving place to new ones, but why would I want to inherit the users class inside the users class.

Any tip on what might be wrong or what I am missing will be appreciated.

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I solve this error by adding if view_type == 'form': before result['arch'] =

It looks like when viewing the tree view the result was called triggering the error.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

HI, you can follow following tutorial for this:

https://youtu.be/kwkddYoFQCE

Hope it helps,

Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มิ.ย. 21
3505
1
มี.ค. 15
4945
1
ก.ย. 23
2157
2
มี.ค. 22
5957
0
เม.ย. 20
3880