Reputation: 1
I'm new to OpenERP. I developed a new module to install in OpenERP v7 on ubuntu12.04 and eclipse juno, but i'm getting following error.
"ValidateError Error occurred while validating the field(s) arch: Invalid XML for View Architecture!"
can any one help me...
Below is my all files.
_init_.py
import mymodule
__openerp__.py
{
'name': 'mymodule',
'version': '1.0',
'category': 'My own Module',
'description': """
This is customised mymodule
""",
'author': 'SANTOSH',
'maintainer': 'SANTOSH',
'images' : ['images/icon.jpg'],
'depends': ['base','web'],
'init_xml' : ['mymodule_menu.xml'],
'data': [
'mymodule_menu.xml',
],
'demo': [
'mymodule_menu.xml',
],
'test': [
'mymodule_menu.xml',
],
'installable': True,
'auto_install': False,
}
mymodule.py
from openerp.osv import fields, osv
class mymodule_test(osv.osv):
_name = "mymodule.test"
_column = {'name':fields.char('Name',size=256, Required = True ),
'company':fields.char('Company', size = 256, Required = True),
}
mymodule_test()
mymodule_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="mymodule.test_view_form">
<field name="name">Mymodule</field>
<field name="model">mymodule.test</field>
<field name="arch" type="xml">
<form string="Mymodule" version="7.0">
<field name="name"/>
<field name="company"/>
</form>
</field>
</record>
<record id="action_mymodule" model="ir.actions.act_window">
<field name="name">mymodule</field>
<field name="res_model">mymodule.test</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
</record>
<menuitem id="section_main_menu" name="Mymodule" />
<menuitem id="menuitem_id" name="MymoduleList" parent="section_main_menu" action="action_mymodule" />
</data>
</openerp>
Upvotes: 0
Views: 1162
Reputation: 3051
I had the same error message but my problem was simply that, writing an "openacademy" module, I had wrote in openacademy.py
:
class openacademy_course(osv.osv):
_name = 'course'
…
When I should have wrote :
class openacademy_course(osv.osv):
_name = 'openacademy.course'
So it may not help you specific case, but maybe others will find your question with the same problem.
Upvotes: 0
Reputation: 3613
This is the working module of yours. Please revert for clarification.
_init_.py
import mymodule
_openerp_.py
{
'name': 'mymodule',
'version': '1.0',
'category': 'Tools', # There's a procedure to add your own category
'description': """
This is customised mymodule
""",
'author': 'Vivek',
'depends': [
'base'
],
'data': ['mymodule_menu.xml'],
'demo': [],
'installable': True,
'auto_install': False
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
mymodule_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id=" test_view_form">
<field name="name">Mymodule</field>
<field name="model">mymodule.test</field>
<field name="arch" type="xml">
<form string="Mymodule" version="7.0">
<field name="name"/>
<field name="company"/>
</form>
</field>
</record>
<!-- Module Tree View -->
<record id="view_mymodule_tree" model="ir.ui.view">
<field name="name">My Module</field>
<field name="model">mymodule.test</field>
<field name="arch" type="xml">
<tree string="My Module">
<field name="name" string="Name" />
<field name="company" string="Company" />
</tree>
</field>
</record>
<record id="action_mymodule" model="ir.actions.act_window">
<field name="name">mymodule</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mymodule.test</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form </field>
</record>
<!-- Top Menu Item -->
<menuitem name="My Module" id="menu_mymodule" />
<!-- Left-side menu: Guests -->
<menuitem name="My Module List" parent="menu_mymodule" id="mymodule_label" />
<!-- Action Menu -->
<menuitem name="Actual Module List" parent="mymodule_label" id="mymodule_label_actual"
action="action_mymodule" />
</data>
</openerp>
mymodule.py
from openerp.osv import fields, osv
class mymodule_test(osv.osv):
_name = "mymodule.test"
_columns = {'name':fields.char('Name',size=256, Required = True ),
'company':fields.char('Company', size = 256, Required = True),
}
mymodule_test()
You've missed many things. Please compare your code and this code to see the places you've missed.
This is my notes on adding a new category
How to add a new category for the developed Module? The module category list is loaded from the file server/openerp/addons/base/module/module_data.xml.
You can also see it querying the ir_module_category Postgres table.
This is what I found:
seq name
=== ================================
1 Customer Relationship Management
2 Sales Management
3 Project Management
4 Knowledge Management
5 Warehouse Management
6 Manufacturing
7 Invoicing & Payments
8 Accounting & Finance
9 Purchase Management
10 Human Resources
11 Extra Tools
12 Marketing
13 Point of Sale
14 Advanced Reporting
And since the category id is a many2one field, no, you can't have more than one category for a module. Choose the most representative one (under which top menu will most of the menu options be?).
To Add new Category
In module_data.xml
<record model="ir.module.category" id="module_category_custom_modules">
<field name="name">Custom Modules</field>
<field name="sequence">16</field>
</record>
Upvotes: 0
Reputation: 3207
Many mistakes in your code, syntax and logical.
why you write 'mymodule_menu.xml' this view in init, data, and demo and test, in version 7.0 init replace with data = [], and in init only include those file who will load at initiate time , demo are use for demo data, and test for testing file like yml
_column use _columns you missed (s)
in menu creation use three layer , first super parent, parent and menu child other wise it will not be clicable.
to getting invalid xml error is because you have you missed 2. point _cloumn instead of _columns
hope this help
before going to develp first read openerp documentation in doc.openerp.com
Upvotes: 2