import mymodule
+Fortunately, there is a mechanism to help you set up an module. The command
+``odoo.py`` has a subcommand ``scaffold`` to create an empty module:
+
+.. code:: bash
+
+ odoo.py scaffold <module name> <where to put it>
+
+The command creates a subdirectory for your module, and automatically creates a
+bunch of standard files for a module. Most of them simply contain commented code
+or XML. The usage of most of those files will be explained along this tutorial.
+
.. exercise:: Module creation
- Create an empty module Open Academy, install it in Odoo.
+ Use the command line above to create an empty module Open Academy, and
+ install it in Odoo.
.. only:: solutions
- #. Create a new folder ``openacademy``
- #. Create an empty ``openacademy/__init__.py`` file
- #. Create an ``openacademy/__openerp__.py`` file
+ #. Invoke the command ``./odoo.py scaffold openacademy addons`` in the
+ Odoo directory.
+ #. Adapt the manifest file to your module.
+ #. Don't bother about the other files.
.. patch::
.. only:: solutions
- #. Create a new file ``openacademy/course.py``
- #. Edit ``openacademy/__init__.py`` to import it
+ Edit the file ``openacademy/models.py`` to include a *Course* class.
.. patch::
.. only:: solutions
- #. Create a new file ``openacademy/demo.xml``
- #. Add the file to the ``'demo'`` list of your ``__openerp__.py``
+ Edit the file ``openacademy/demo.xml`` to include some data.
.. patch::
.. only:: solutions
- Create class *Session*:
+ Create the class *Session* in ``openacademy/models.py``.
.. patch::
inspect the view, find its external ID and the place to put the
new field.
- #. Create a ``openacademy/partner.py`` and import it in
+ #. Create a file ``openacademy/partner.py`` and import it in
``__init__.py``
- #. Create an ``openacademy/views/partner.xml`` and add it to
+ #. Create a file ``openacademy/views/partner.xml`` and add it to
``__openerp__.py``
.. patch::
#. Create a new file ``openacademy/security/security.xml`` to
hold the OpenAcademy Manager group
- #. Create a new file ``openacademy/security/ir.model.access.csv`` with
+ #. Edit the file ``openacademy/security/ir.model.access.csv`` with
the access rights to the models
- #. finally update ``openacademy/__openerp__.py`` to add the new data
+ #. Finally update ``openacademy/__openerp__.py`` to add the new data
files to it
.. patch::
.. only:: solutions
- #. Create a ``openacademy/views/session_board.xml``. It should contain
+ #. Create a file ``openacademy/views/session_board.xml``. It should contain
the board view, the actions referenced in that view, an action to
open the dashboard and a re-definition of the main menu item to add
the dashboard action