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

I have a python code where I want to translate a field name and a model name, which are stored in another record, to the display string for the current user language.

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

My solution in slightly different situation:

self.env['ir.translation'].get_field_string(self._name)['field_name']
อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I found a solution:

self.env['ir.translation'].get_field_string(record.ref_class)[record.ref_field]
อวตาร
ละทิ้ง