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

Hi,

I have an email template that displays some variable information, but I can't seem to show the value of a selection field.

The below code shows the selection KEY, but not the VALUE.  For example if x_order_type is a selection field with values [('R','Regular'),('D','Dropship')], I want to show "Regular" instead of "R".


<TR>

<td width=15%>${opiline.x_opi_topic_id.x_name}</td>

<td width=10%>${opiline.x_responsible}</td>

<td width=10%>${opiline.x_order_type}</td>

<td width=65%>${opiline.x_instruction or ''}<br>(last update:${opiline.write_date})</td>

</TR>

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

Hello Seppe,

By using below condition you get value of your selection field.

dict(self.fields_get(allfields=['x_order_type'])['x_order_type']['selection'])['R']

Thanks.

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

you can get your answer on below link-

\https://www.odoo.com/forum/help-1/question/showing-the-string-value-of-a-selection-field-in-qweb-report-92686

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

Try:


dict(object.fields_get(allfields=['field_name'])['field_name']['selection'])[object.field_name]

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ธ.ค. 19
16502
1
ก.ค. 25
667
1
มิ.ย. 25
1596
0
ส.ค. 23
2061
0
เม.ย. 16
4508