Book Image

Odoo Development Cookbook

By : Holger Brunn, Alexandre Fayolle, Daniel Reis
Book Image

Odoo Development Cookbook

By: Holger Brunn, Alexandre Fayolle, Daniel Reis

Overview of this book

Odoo is a full-featured open source ERP with a focus on extensibility. The flexibility and sustainability of open source is also a key selling point of Odoo. It is built on a powerful framework for rapid application development, both for back-end applications and front-end websites. The book starts by covering Odoo installation and administration, and provides a gentle introduction to application development. It then dives deep into several of the areas that an experienced developer will need to use. You’ll learn implement business logic, adapt the UI, and extend existing features.
Table of Contents (23 chapters)
Odoo Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using the noupdate and forcecreate flags


Most addons have different types of data. Some data simply needs to exist for the module to work properly, other data shouldn't even be changed by the user, while most data is meant to be changed per the user's pleasure and is only provided as a convenience. This recipe will detail how to address the different types. First, we'll write a field in an already existing record, then, we'll create a record that is supposed to be recreated during a module update.

How to do it...

We can enforce different behaviors from Odoo when loading data by setting certain attributes on the enclosing odoo element or the record element itself.

  1. Add a publisher only created at installation time, but not updated on subsequent updates. However, if the user deletes it, it will be recreated:

    <odoo noupdate="1">
        <record id="res_partner_packt" model="res.partner">
            <field name="name">Packt publishing</field>
        </record>
    </odoo>
  2. Add...