odoo v8 - 字段“arch”因约束而失败:无效的视图定义
Posted
技术标签:
【中文标题】odoo v8 - 字段“arch”因约束而失败:无效的视图定义【英文标题】:odoo v8 - Field(s) `arch` failed against a constraint: Invalid view definition 【发布时间】:2015-06-22 13:21:19 【问题描述】:我想用 DB 视图创建一个新视图。 当我尝试安装我的应用程序时,创建了 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,
...
我的代码有什么问题?
【问题讨论】:
现在还有另一个问题:文件“/opt/odoo/odoo-server/openerp/models.py”,第 6069 行,在 _normalize_ids return tuple(arg) TypeError: 'float' object is not可迭代 【参考方案1】:你在定义 _columns 时犯了一个愚蠢的错误。
_colums is not valid dictionary name for fields structure. Replace this by
_columns and restart service and update module.
【讨论】:
以上是关于odoo v8 - 字段“arch”因约束而失败:无效的视图定义的主要内容,如果未能解决你的问题,请参考以下文章
Hibernate 4.3.11 - Envers 因 ZonedDateTime 字段而失败