我想用DB-view创建一个新视图。 当我尝试安装我的应用程序时,创建了DB-view,然后出现错误:
2015-06-22 12:59:10,574 11988 ERROR odoo
openerp.addons.base.ir.ir_ui_view: Das Feld `datum` existiert nicht
Fehler Kontext:
Ansicht `overview.tree.view`
[view_id: 1532, xml_id: k. A., model: net.time.overview, parent_id: k. A.]
2015-06-22 12:59:10,577 11988 ERROR odoo openerp.http: Exception during JSON request handling.
ParseError: "ValidateError
Field(s) `arch` failed against a constraint: Invalid view definition
Error details:
Das Feld `datum` existiert nicht
Fehler Kontext:
Ansicht `overview.tree.view`
[view_id: 1532, xml_id: k. A., model: net.time.overview, parent_id: k. A.]" while parsing /opt/odoo/odoo-server/addons/net_time_overview/net_time_overview_view.xml:8, near
<record id="net_time_overview_tree_view" model="ir.ui.view">
<field name="name">overview.tree.view</field>
<field name="model">net.time.overview</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="List">
<field name="name" readonly="1"/>
<field name="datum" readonly="1"/>
</tree>
</field>
</record>
码
from openerp import tools
from openerp.osv import fields, orm, osv
class net_time_overview (osv.osv):
_auto = False
_name = 'net.time.overview'
_description = "Zeituebersicht"
_colums = {
'datum' : fields.date("datum", readonly=True),
'name' : fields.char('name', readonly=True),
'wochentag' : fields.char('wochentag', readonly=True),
'beschreibung' : fields.char('beschreibung', readonly=True),
'arbeitsstd' : fields.char('arbeitsstd', readonly=True),
'sollstd' : fields.char('sollstd', readonly=True),
'abwesend_bez' : fields.char('abwesend_bez', readonly=True),
'user_id':fields.many2one('res.users', 'Validation User', readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'net_time_overview')
cr.execute("""
CREATE OR REPLACE VIEW net_time_overview AS (
SELECT
(to_char(datum, 'yymmdd'))::numeric AS id,
datum AS datum,
res.user_id,
res.name,
to_char(datum, 'TMDay') AS wochentag,
...
我的代码出了什么问题?
答案 0 :(得分:2)
你在定义_columns时犯了愚蠢的错误。
_colums is not valid dictionary name for fields structure. Replace this by
_columns and restart service and update module.