Hello everyone,
I'm trying to create a custom module that can add fields to an existing view. I followed this tutorial to create the module : http://www.pixelite.co.nz/article/adding-additional-fields-using-custom-module-openerp-7/ but i get an error when i try to install it : arch: Invalid XML for View Architecture!
I'm using OpenERP 7 on Windows 7.
This is my module configuration:
__init__.py
import demo
__openerp__.py
{
"name": "Demo module",
"version": "0.2",
"author": "Amre",
"category": "Demo",
"depends": ["base"],
"demo": [],
"data": ["demo_view.xml"],
"installable": True,
}
demo.py
from openerp.osv import osv, fields
class demo(osv.osv):
_inherit = "res.partner"
_columns = {
'demo_id': fields.integer('Demo ID', size=11),
}
_defaults = {
'demo_id': 0
}
demo()
demo_view.xml
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="demo_view_form">
<field name="name">res.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/group/group/field[@name='website']" position="after">
<field name="demo_id"/>
</xpath>
</field>
</record>
</data>
</openerp>
This module example needs to add a field called "demo_id" to the existing view "base.view_partner_form".
Thanks a lot for you effort and your help.
EDIT 1 : I corrected the xpath with "form", but i still get the same error.
EDIT 2 : made corrections suggested by Akhil P Sivan, i still get the same error again :(
EDIT 3 : made corrections suggested by Temur,the code now works like a charm :D. Good job guys !