后台log在哪里可以看到?
我重启了应用,又试了一种方式还是不行。
models.py
class Teachers(models.Model):
_name = 'academy.teachers'
_columns = {
'name' : fields.Char(),
'biography' : fields.Char(),
}
哎,头大啊。。
76845559
-
开发问题求助 -
开发问题求助[attachimg=1]加上上述加粗、斜体后发生的错误提示。
-
开发问题求助这个程序我一直是按照官网上的教程写的,可就是不知道问题在哪里。
-
开发问题求助学习了一段时间的ODOO,觉的挺强大,想深入研究一下,于是上论坛官网查找学习教程,发现资源极少。尤其中文资源极少,好像这里的老肖,JEFF比较历害,在百度能找到他们写的文章。于是边学习边按照官网的程序写代码,以前没有学习过Python,不知道空格居然是这个语言的{},害的我总不知道错误发生在哪里。还好,这个问题解决了,但又遇到了新的问题,我想给比如这个程序里面的老师后面加一个简介,结果只要加上新的字段,就会出现错误。请各位大咖帮忙看看错误差生在哪里。
这张图是正常显示的图片。[attachimg=1][attachimg=2]
代码:init.py
from . import controllers
from . import models
openerp.py
{
'name' : 'academy',
'version': '1.0',
'author': 'Char.ey',
'category': 'Hidden',
'complexity': 'easy',
'description': "Test website",
'depends': ['website'],
# data files which are always installed
'data': [
'templates.xml',
'ir.model.access.csv',
'views.xml',
],
# data files which are only installed in "demonstration mode"
'demo': [
'demo.xml',
],
}
controllers.py
# -- coding: utf-8 --
from openerp import http
class Academy(http.Controller):
@http.route('/academy/', auth='public' , website=True)
def index(self):
Teachers = http.request.env['academy.teachers']
return http.request.render('academy.index', {
'teachers': Teachers.search([]),
})
models.py
from openerp import fields
from openerp import models
class Teachers(models.Model):
_name = 'academy.teachers'
name = fields.Char()
[u][i][b] biography = fields.Char()[/b][/i][/u]
templates.xml
<openerp><data>
<template id="index">
<t t-call="website.layout">
<t t-set="title">Academy</t>
<div class="oe_structure">
<div class="container">
<t t-foreach="teachers" t-as="teacher">
<p><t t-esc="teacher.id"/> <h3 t-field="teacher.name"/> [u][i][b]<h3 t-field="teacher.biography"/>[/b][/i][/u]</p>
<p>Last modified: <i t-field="teacher.write_date" t-field-options='{"widget": "relative"}'/></p>
</t>
<>
<>
</t>
</template>
</data></openerp>
demo.py
<openerp><data>
<record id="padilla" model="academy.teachers">
<field name="name">Diana Padilla</field>
<field name="biography">Diana Padilla biography</field>
</record>
<record id="carroll" model="academy.teachers">
<field name="name">Jody Carroll</field>
<field name="biography">Diana Padilla biography</field>
</record>
<record id="vaughn" model="academy.teachers">
<field name="name">Lester Vaughn</field>
<field name="biography">Diana Padilla biography</field>
</record>
</data></openerp>
view.py
<openerp><data>
<record id="action_academy_teachers" model="ir.actions.act_window">
<field name="name">Academy teachers</field>
<field name="res_model">academy.teachers</field>
</record>
<record id="academy_teacher_form" model="ir.ui.view">
<field name="name">Academy teachers: form</field>
<field name="model">academy.teachers</field>
<field name="arch" type="xml">
<form>
<sheet>
<label for="name"/> <field name="name"/>
[u][i][b] <label for="biography"/> <field name="biography"/>[/b][/i][/u]
</sheet>
</form>
</field>
</record>
<menuitem sequence="0" id="menu_academy" name="Academy"/>
<menuitem id="menu_academy_content" parent="menu_academy"
name="Academy Content"/>
<menuitem id="menu_academy_content_teachers"
parent="menu_academy_content"
action="action_academy_teachers"/>
</data></openerp>
ir.model.access.csv
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_academy_teachers,access_academy_teachers,model_academy_teachers,,1,0,0,0
其中加粗、斜体、下滑线为加上此字段后开始出现错误的地方。