formview


odoo: error creating new form view : Field(s) `arch` failed against a constraint: Invalid view definition


I want to create new form view associated to new data model, I create a new menu item "menu1" that has a submenu "menus" and then, I want to customize the action view. This is my code:
My xml file:
My data model:
from openerp.osv import fields, osv
class hr_cutomization(osv.osv):
_inherit = "hr.employee"
_columns = {
'new_field_ID': fields.char('new filed ID',size=11)
}
_default={
'new_field_ID':0
}
hr_cutomization()
class hr_newmodel(osv.osv):
_name = "hr.newmodel"
_columns = {
'field1': fields.char('new filed1',size=11),
'field2': fields.char('new filed2',size=11)
}
_default={
'field1':0
}
hr_newmodel()
When I update my module, I got this error:
ParseError: "ValidateError
Field(s) arch failed against a constraint: Invalid view definition
Error details:
Element '
what's doing wrong in my code ?
Just Update your view action in your xml file some think like this
<record id="new_action" model="ir.actions.act_window">
<field name="name">New</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.newmodel</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="view_new_form"/>
</record>
Just update your py file
from openerp.osv import fields, osv
class hr_cutomization(osv.osv):
_inherit = "hr.employee"
_columns = {
'new_field_ID': fields.char('new filed ID',size=11)
}
_default={
'new_field_ID':'0'
}
hr_cutomization()
class hr_newmodel(osv.osv):
_name = "hr.newmodel"
_columns = {
'field1': fields.char('new filed1',size=11),
'field2': fields.char('new filed2',size=11)
}
_default={
'field1':'0'
}
hr_newmodel()
In this .py your are assign as char field but you are using _defaults as 0 (as integer)
you must have to pass it as character not the integer in your _default attributes.
and you are creating your module in OpenERP 7.0 then the add the new form Attribute as the version="7.0" in your form tag of your view.
If it is in odoo 8.0 then it is not needed to do so.
I got the same error, and in my case it was because of a wrong indentation in my .py file. Try doing the indentation in the correct way, something like this:
from openerp.osv import fields, osv
class hr_cutomization(osv.osv):
_inherit = "hr.employee"
_columns = {
'new_field_ID': fields.char('new filed ID',size=11)
}
_default={
'new_field_ID':'0'
}
hr_cutomization()
class hr_newmodel(osv.osv):
_name = "hr.newmodel"
_columns = {
'field1': fields.char('new filed1',size=11),
'field2': fields.char('new filed2',size=11)
}
_default={
'field1':'0'
}
hr_newmodel()
I think that way could work

Related Links

odoo: error creating new form view : Field(s) `arch` failed against a constraint: Invalid view definition
Modify OpenERP 6.1 product form view in web client
how can i get last id inserted in formview

Categories

HOME
beautifulsoup
fabricjs
google-cloud-platform
sitecore
solver
switch-statement
google-admin-sdk
augeas
jquery-ui-sortable
drop-down-menu
dkim
java.util.logging
spring-social
coin3d
standards
feathersjs
vuejs
asciidoctor-pdf
springfox
squashfs
named-entity-recognition
expressionengine3
tiki-wiki
gpio
mat
outliers
angular-translate
volatile
livelink
postback
biztalk-rule-engine
reactjs.net
reactivekit
verifiable-c
metaprogramming
levenshtein-distance
attributeerror
subclipse
stylecop
tf
x-ray
amq
lsyncd
d3-force-directed
pure-css
simplepie
builtins
webjars
burrows-wheeler-transform
mongodb-php
firebase-security
createprocess
ellucian-scribe
realsense
state-restoration
boomerang
dynatree
gocql
xenomai
video-player
fuelcms
slash
cwrsync
zxspectrum
shopizer
dot.js
sip-server
metatrader5
universal-image-loader
template-deduction
memset
gwt-openlayers
light
embedded-fonts
breakout
printdialog
kogrid
abstract-data-type
mysql-error-2013
bjyauthorize
listitem
kqueue
agility.js
tournament
uipagecontrol
w3c-geolocation
timthumb
mtu
timertask
cruisecontrol.rb
updatesourcetrigger
glui
interop-domino

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App