diff options
| author | Raphael Collet <rco@openerp.com> | 2014-08-22 17:51:20 +0200 |
|---|---|---|
| committer | Raphael Collet <rco@openerp.com> | 2014-08-22 17:51:20 +0200 |
| commit | 2ad092b5e54fa39a906b38d9240e08b9800ea0da (patch) | |
| tree | 1879c2a6efe8ed1626d92635870aaff922306492 /doc/03_module_dev_05.rst | |
| parent | 97256fa1fba6c7d3d02962b5948158d17852cf43 (diff) | |
[ADD] doc: new documentation, with training tutorials, and new scaffolding
Diffstat (limited to 'doc/03_module_dev_05.rst')
| -rw-r--r-- | doc/03_module_dev_05.rst | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/doc/03_module_dev_05.rst b/doc/03_module_dev_05.rst deleted file mode 100644 index 3bddecf9140..00000000000 --- a/doc/03_module_dev_05.rst +++ /dev/null @@ -1,93 +0,0 @@ -.. _module-dev-example: - -========================== -Example of module creation -========================== - -Getting the skeleton directory -++++++++++++++++++++++++++++++ - -Create a ``travel`` directory, that will contain our addon. Create **__init__.py** file and **__openerp__.py** files. - -Edit the **__openerp__.py** module manifest file: - -.. code-block:: python - - { - "name" : "Travel agency module", - "version" : "1.1", - "author" : "Tiny", - "category" : "Generic Modules/Others", - "website" : "http://www.openerp.com", - "description": "A module to manage hotel bookings and a few other useful features.", - "depends" : ["base"], - "init_xml" : [], - "update_xml" : ["travel_view.xml"], - "active": True, - "installable": True - } - -Changing the main module file -+++++++++++++++++++++++++++++ - -Now you need to update the travel.py script to suit the needs of your module. -We suggest you follow the Flash tutorial for this or download the travel agency -module from the 20 minutes tutorial page. :: - - The documentation below is overlapping the two next step in this wiki tutorial, - so just consider them as a help and head towards the next two pages first... - -The travel.py file should initially look like this: - -.. code-block:: python - - from osv import osv, fields - - class travel_hostel(osv.osv): - _name = 'travel.hostel' - _inherit = 'res.partner' - _columns = { - 'rooms_id': fields.one2many('travel.room', 'hostel_id', 'Rooms'), - 'quality': fields.char('Quality', size=16), - } - _defaults = { - } - travel_hostel() - -Ideally, you would copy that bunch of code several times to create all the -entities you need (travel_airport, travel_room, travel_flight). This is what -will hold the database structure of your objects, but you don't really need to -worry too much about the database side. Just filling this file will create the -system structure for you when you install the module. - -Customizing the view -++++++++++++++++++++ - -You can now move on to editing the views. To do this, edit the custom_view.xml file. It should first look like this: - -.. code-block:: xml - - <openerp> - <data> - <record model="res.groups" id="group_compta_user"> - <field name="name">grcompta</field> - </record> - <record model="res.groups" id="group_compta_admin"> - <field name="name">grcomptaadmin</field> - </record> - <menuitem name="Administration" groups="admin,grcomptaadmin" - icon="terp-stock" id="menu_admin_compta"/> - </data> - </openerp> - -This is, as you can see, an example taken from an accounting system (French -people call accounting "comptabilité", which explains the compta bit). - -Defining a view is defining the interfaces the user will get when accessing -your module. Just defining a bunch of fields here should already get you -started on a complete interface. However, due to the complexity of doing it -right, we recommend, once again, that download the travel agency module example -from this link http://apps.openerp.com/ - -Next you should be able to create different views using other files to separate -them from your basic/admin view. |
