2
は私の例です:は自宅にデータをレンダリング(インデックス)私は下記、自宅(インデックス)ページ上のデータをレンダリングするページodoo 9
コントローラ:
import openerp.http as http
from openerp.http import request
class TestController(http.Controller):
@http.route('/index',auth='public',website=True)
def list(self,**kw):
Test9 = http.request.env['test.9']
arr = Test9.search([])
print arr
return http.request.website.render('website.layout',
{'test9':Test9.search([])
})
XML
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="test9" name="Test9" page="True">
<t t-call="website.layout">
<div class="oe_structure">
<div class="container">
<center><h3>Details</h3></center>
<t t-foreach="test9" t-as="company">
<h4><span t-esc="company.name"/></h4>
<table class="table-striped table">
<tr>
<td>Name:</td>
<td><span t-esc="company.name"/></td>
</tr>
<tr>
<td>City:</td>
<td><span t-esc="company.city"/></td>
</tr>
<tr>
<td>Place:</td>
<td>
<td><span t-esc="company.place"/></td>
</td>
</tr>
</table>
</t>
</div>
</div>
</t>
</template>
</data>
</openerp>
実行後http://localhost:8069/indexコンソールで2つのレコードを取得
私のコードで問題はどこですか?
...................................... .................................................. ................................................
http:// localhost:8069/indexでhttp:// localhost:8069 /のデータを返します。どのようにホームページのデータを取得するのですか?これはodooのデフォルト名ですか? –
私はここにデータが必要ですhttp://imgur.com/a/SO6rC –
私の回答を更新します –