Browse Source

添加QWeb模板

Your Name 2 months ago
parent
commit
64ccacaae7
1 changed files with 17 additions and 0 deletions
  1. 17 0
      cat_app/views/book_list_template.xml

+ 17 - 0
cat_app/views/book_list_template.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+    <template id="book_list_template" name="Book List">
+        <div id="wrap" class="container">
+            <h1>Books</h1>
+            <!-- t-foreach用于遍历变量 books变量中的每一项,通过控制器的http.request.render()调用来获取。
+            t-field属性用于渲染Odoo记录字段的内容。 -->
+            <t t-foreach="books" t-as="book">
+                <div class="row">
+                    <span t-field="book.name" />,
+                    <span t-field="book.date_published" />,
+                    <span t-field="book.publisher_id" />
+                </div>
+            </t>
+        </div>
+    </template>
+</odoo>