Developing a module for an enterprise package

Adding to an enterprise package without touching its standard, using Odoo as the example: a module's anatomy, dependencies, extending a model and a screen, computed fields, access rights and surviving a version upgrade.

  • 23 cards
  • 5 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. Scenarios
  5. Understand

A few cards from the deck

  • Package module: what is it?

    Show the answer

    A self-contained folder that groups a manifest, models, views, rights and data, and that is installed or removed without touching the rest of the application.

    All of Odoo is made of modules, sales and invoicing included. Adding a feature means writing one more module, stacked on top of the others.

  • What does this code do?

    ```python
    class SaleOrder(models.Model):
    _inherit = 'sale.order'

    return_date = fields.Date()
    `

    • It adds return_date to the existing sale.order model, in its table
    • It creates a separate new model, a copy of sale.order, with its own table
    • It replaces the sale.order model with a class that only has this field
    • It edits the sale module's file to write the added field into it
    Show the answer

    It adds return_date to the existing sale.order model, in its table

    With _inherit alone, you complete the existing model. Adding a different _name would give a copy in a new table. The sale file is never touched.

  • In the manifest, the … key lists the modules to install before ours, and the … key lists the view, rights and data files loaded at installation.

    Show the answer

    In the manifest, the depends key lists the modules to install before ours, and the data key lists the view, rights and data files loaded at installation.

    Odoo installs the dependencies first, then loads the data files in list order: rights and groups before the views that use them.

  • Module manifest: what is it?

    Show the answer

    The __manifest__.py file that describes the module: its name, its version, the modules it depends on and the list of data and view files to load.

    Without it, Odoo ignores the folder. A file that refers to another module's model or view is only sure to find them if that module is listed in depends: otherwise, installation can fail.

  • The loan module is installed, but salespeople get "Access denied" on the new loan model, while the technical administrator can open it. What do you do?

    • Put all the salespeople in the technical administrators' group so that they can get in
    • Make the borrower field required in the loan model, then update the module
    • Add 'sale' to the manifest's depends list, then fully reinstall the module
    • Add a line in ir.model.access.csv that gives the salespeople's group its rights on the model
    Show the answer

    Add a line in ir.model.access.csv that gives the salespeople's group its rights on the model

    A new model is only open to the groups that a line of that file names: here, only administrators have one. Making salespeople administrators would open far more than loans: grant only what is needed.