Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
8970 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

My solution in slightly different situation:

self.env['ir.translation'].get_field_string(self._name)['field_name']
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I found a solution:

self.env['ir.translation'].get_field_string(record.ref_class)[record.ref_field]
Ảnh đại diện
Huỷ bỏ