Opnerp create a new module
What
you need to create a basic module is only 4 files……
1.
__init__.py
2.
__openerp__.py
3.
Html.py
4.
html_view.py
·
In init.py file what we need to do is just to
import the module name like
Import test
·
In the opener.py file we need a few description
regarding the module like
{
"name" : "Html
View",
"version" :
"1.1",
"author" :
"OpenERP SA",
"category" :
"Hidden/Test",
"depends" : ['base'],
"init_xml" :
['html_view.xml'],
"demo_xml" : [],
"description":
"""
This is the test module which shows HTML tag support in normal XML form
view.
=============================================================================
Creates a sample form-view using HTML tags. It is visible only in OpenERP
Web.
""",
'update_xml':
['security/ir.model.access.csv','html_view.xml',],
'installable': True,
'auto_install': False,
'certificate':
'001302129363003126557',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
·
In the html.py file we describe the types of
fields that we want to use
from osv import osv, fields
class html_view(osv.osv):
_name = 'html.view'
_columns = {
'name': fields.char('Name',
size=128, required=True, select=True),
'comp_id':
fields.many2one('res.company', 'Company', select=1),
'bank_ids':
fields.one2many('res.partner.bank', 'partner_id', 'Banks'),
}
html_view()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
·
And lastly the html_view.xml file we use for the
view which will be appearing in the window
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record
id="html_view_form" model="ir.ui.view">
<field
name="name">htmlform</field>
<field
name="model">html.view</field>
<field
name="type">form</field>
<field
name="arch" type="xml">
<form string="Html
Example">
<field
name="name"/>
<field
name="bank_ids"/>
</record>
<record
id="action_html_view_form"
model="ir.actions.act_window">
<field
name="name">Html Test</field>
<field
name="type">ir.actions.act_window</field>
<field
name="res_model">html.view</field>
<field
name="view_type">form</field>
</record>
<menuitem
action="action_html_view_form" id="html_form"
parent="base.menu_address_book" sequence="40"/>
</data>
</openerp>
THINGS TO REMEMBER
1.
Line spacing that is the intent of the lines
2.
The module once coded must be copied to the
addons folder of opener
3.
To install the module follw the steps
1.
Open the settings in opener if you are using opener
v 6.1
2.
Then click on modules > update module list
3.
It will be taking some time and return that 1
module is added just as you close the window by clicking OK button we are
diverted to module list.
4.
We will have to search there with the name of
the module we have created.
5.
Then just press the install button to install the
module
6.
ENJOY YOURS MODULE IS READY…………….
Last thing i would recommend to any beginner is to just read the Idea module of openerp any one can have a good hands with that module as that contains nearly all the things one needs to learn.