Generate a models
In this section we will see how to generate a new model and any fields you need:
Usage¶
codoo models [OPTIONS]
Available options¶
Option | Type | Default | Description |
---|---|---|---|
-t, --type | [Model,TransientModel,AbstractModel] | Model | The of the model |
-n, --name | TEXT | The name of the model, (e.g: Awesome model) | |
-d, --description | TEXT | The description of the model | |
-a, --addons | TEXT | The name of the addon, (e.g: codoo demo) |
Note
All the options are mandatory.
Extra options¶
The command will ask you some questions - answer them like done below:
Option | Type | Default | Description |
---|---|---|---|
Do you want to add fields? | BOOLEAN | False | Choose to add a new field or not |
Field name? | TEXT | Type a field name (e.g: website_url) | |
Type? | Field types1 | Char | Type a field name (e.g: website_url) |
Comodel name ? | TEXT | Only for (One2many, Many2one, Many2many) field type | |
Inverse field name ? | TEXT | Only for One2many field type |
Examples¶
codoo models \
-t "Model" \
-n "Awesome model" \
-d "Awesome new model generated by codoo cli" \
-a codoo_demo \
Woh! we now have a new model (addons/codoo_demo/models/awesome_model.py
), in the next section we will grant permissions for it.
-
[Char, Text, Boolean, Integer, Float, Binary, Image, Html, Date, Datetime, One2many, Many2one, Many2many] ↩