Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odoo - scaffolding?

Tags:

odoo

scaffold

I read here that you can scaffold a module using a command, so you won't need to manually create some initial files. But such command does not work on master (on Odoo development branch):

./oe scaffold Academy ../my-modules

Because there is no such file called oe in openerp directory. Did this thing change in the newest version? How can I scaffold a module in Odoo?

like image 704
Andrius Avatar asked Jun 24 '14 11:06

Andrius


People also ask

What is scaffolding in Odoo?

Scaffolding is the way of building a skeleton structure for a module in Odoo. Using Odoo scaffolding we can create the module structure automatically. It saves much of our effort in creating a module manually.

Is Odoo modular?

One of the characteristics that differentiates Odoo from many other ERP software is its modular architecture. There are over 35 base Odoo modules or odoo apps, covering a vast array of business functions, from Manufacturing, Inventory, and Accounting, to Sales, eCommerce, HR, and more.

What is an Odoo module?

Odoo Accounting Module. Odoo Accounting Module is one of the tools of the Odoo platform, designed to increase business productivity. The module automates the work of accountants and allows tracking of the company cash flow.


3 Answers

Now odoo 10 or later version use odoo-bin insted of odoo.py

  1. On the shell or terminal, change directory to your odoo folder. Maybe it's in /opt/odoo, or maybe it's in /home/odoo :

    cd /opt/odoo
    
  2. Create a new module using the odoo.py script:

    ./odoo.py scaffold my_new_module ./addons/
    

(where my_new_module is a name of your new module, and ./addons/ is the Odoo addons directory)

  1. Edit the ./addons/my_new_module/__openerp__.py file.

    nano ./addons/my_new_module/__openerp__.py
    
  2. Change the name field to set a user friendly name of your module (for example "Andrius's New Module"). Change description and fields also. And add your needed modules, such as 'mail', to the to the list of module dependencies depends.

    'depends': ['base', 'mail'],
    
  3. Edit models.py

    nano ./addons/my_new_module/models.py
    
  4. Add code in your my_new_module/models.py file, for example:

from openerp import models, api

class FooterlessNotification(models.Model)
    _inherit = 'mail.notification'

    @api.model
    def get_signature_footer(self, user_id, res_model=None, res_id=None, context=None, user_signature=True):
        return ""

(As an example, this code will extend the 'mail.notification' model and replace its get_signature_footer method with one that returns an empty footer.)

  1. Install your module via Odoo settings.

To find it there you may need to use the "Update Module List" option.

If you can't find the option "Update Module List" either, you may need to enable the "Technical Features" checkbox in your current user's settings.

To display Modules, not just the Applications, remove the tag "Applications" from the search box filter, by clicking the small "x" before the tag.

like image 56
Chris Coleman Avatar answered Oct 08 '22 01:10

Chris Coleman


You can use ./odoo-bin scaffold MODULE_NAME PATH_TO_STORE_YOUR_MODULE_OR_ADDONS

For example: ./odoo-bin scaffold module_name /odoo/odoo-server/custom_addons/

Here custom_addons is your directory in odoo-server/

cmd in Odoo10:

./odoo-bin scaffold <module_name> <destination path where you want to create> 
like image 37
Madhur Gupta Avatar answered Oct 08 '22 00:10

Madhur Gupta


Use odoo.py instead of oe:

./path/to/odoo/odoo.py scaffold my-module
like image 5
Daniel Reis Avatar answered Oct 08 '22 00:10

Daniel Reis