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

I search what field to overwrite from text to html. This snippet comes from "report_invoice_document" :

<div class="col-xs-2" t-if="o.name">
    <strong>Description:</strong>
    <p t-raw="o.name"/>

I already change t-value to t-raw but I don't find what field of what model to change for html...

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

Hi

In this example, o is an instance of account.invoice, and containt each value of the invoice you want to print

Regards,


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

 You can name it as you want it's just the object of the "foreach" qweb loop. It's normally at the top of the template.

<template id="report_my_report">
    <t t-call="report.html_container">
         <t t-foreach="docs" t-as="o">

The docs is what you pass to the template. 

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

In QWEB, o is an instance of active model(it can sale.order,purchase.order,account.invoice...etc), and it contains each value of the model you want to print

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

For example you have an object (res.partner(1)) . Than by using your code you can get records from that object using alias "o".

o.name

o.gender

etc

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ก.ค. 25
26889
2
มิ.ย. 25
2142
4
พ.ค. 24
6154
1
พ.ค. 23
3949
1
เม.ย. 19
14846