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

Hello,

I want to reduce a field value in template like when i use field number with this format ${object.number} it return whole of number, well i want to reduce it from first and last characters, so any one know how to do this?


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

You can create a method in the object to do so and call it from the template.

@api.multi
def get_number(self)
# Now you can use any python function
return self.number[1:-1] # Get numbers except first and last


${objeect.get_number()}


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มิ.ย. 15
4833
Why can't Odoo find my view? แก้ไขแล้ว
1
มี.ค. 15
4599
Can I determine object type in QWeb? แก้ไขแล้ว
1
ม.ค. 22
8284
1
ก.ค. 16
24381
0
มิ.ย. 16
3717