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

I'm trying to create a pdf report but the error occurs when i add

in template

This is the error:
odoo.addons.base.models.ir_qweb.QWebException: Error when compiling xml template
AssertionError: t-field can not be used on a t element, provide an actual HTML node
Template: school.print_student_badge
Path: /t/t/t/t/div/t
Node:


this is the code of the report xml file:

xml version="1.0" encoding="utf-8"?>

id="school_report_action" model="ir.actions.report">
name="name">Print Badge
name="model">school.student
name="report_type">qweb-pdf
name="report_name">school.print_student_badge
name="report_file">school.print_student_badge
name="binding_model_id" ref="model_school_student"/>
name="binding_type">report

id="print_student_badge">
t-call="web.html_container">
t-foreach="docs" t-as="o">
t-call="web.external_layout">
class="page">


Student reoprt

Name Student:
t-field="o.name"/>







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

Hi 

Try like this 

<div class="col-4"  name="name">
 
<span t-field="o.name"/>
</div>


where name is the field in school.student model


Hope this helps


Regards

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks. it works correctly..
but what is the difference?

The main difference between the two is that <t t-field> is a template tag, while <span t-field> is an HTML tag with an Odoo-specific attribute.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 24
3051
1
thg 9 23
1457
1
thg 6 23
3902
1
thg 4 23
3176
0
thg 3 23
1707