Repository navigation
Add Models and Fields
Two wizards change an existing module: File > Add model to module and File > Add fields to model (also in the Explorer's local menu, on a module, a model's file or a class). Both show every change as a diff before Apply.

A new model (_name) or an extension of an existing one (_inherit; Models... lists the models of the module's dependencies when their folders are found, otherwise type the name). It creates models/<model>.py, adds its import to models/__init__.py, and for a new model adds the access row (Odoo 19 ir.model.access.csv, Odoo 20 ir.access.csv, the series read from the manifest's version) and, optionally, views, an action and a menu under the module's top menu; the manifest's data gets the new files.


Char, Text, Integer, Float, Boolean, Date, Datetime, Selection, Many2one, One2many (with its inverse), Many2many, related, and computed with an @api.depends method stub. Type a field and Add field keeps it and empties the form for the next one; Preview shows them all. They go after the class's last field and, optionally, after the last field of the model's form and list views when the module has exactly one of each (otherwise the preview says they were left alone).


- Edits are minimal: a line appended, an entry inserted, lines after a located field. They are computed from the files' text and parsed again (
astfor Python, ElementTree for XML, CSV,literal_evalfor the manifest) before anything is shown. - A file that cannot be edited exactly, such as a manifest whose
datais not a written list, is refused with the reason. - Apply writes only if every file is still byte-identical to the preview, and saves each edited file atomically. A file with unsaved changes in an editor stops it; open editors show the new text.
Turbodoo · part of Divengine · report an issue