I want to create a new view with a DB-view. When I try to install my app, DB-view was created then I get error:
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>
code
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,
...
What's wrong in my code?
You have made silly mistake in defining _columns.