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

I have two models, first one(Class1) that is writing in API8 and the other (Class2)  on the old one API7.

I need to use Class2's fields in Class1 as related fields using :

class_Relate_Id=fields.Many2one('class2')
field_name = fields.TypeOfField(related='class_Relate_Id.field_name',store=True)

The problem is the field in the old API is a function type : so i have no idea what to put in place of TypeOfField....
Does anyone have an idea ? -Thanks in advance.

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

Example:

aa_currency_id = fields.function( _get_account_currency,  type='many2one', relation='res.currency', string='Analytic Account currency')

check which is the type of the function field

your related field should be:

field_name = fields.Many2one(related="class_relate_id.field_name", store=True)


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
5
พ.ย. 15
4010
1
ม.ค. 19
1406
2
ก.ค. 21
16744
2
เม.ย. 23
6227
Selecting items for one2many relation แก้ไขแล้ว
2
ธ.ค. 22
14925