We can create new models in Odoo without using codes. This method is very easy and
less time consuming. In the studio module we have an option for creating models.
This method will help us to create fields in custom modules or already available
apps.
When we click the New Model button, the next step is to add the name of the model.
Once we add the name, next we have to add the details of models. We can add the
features and click create model.
We have different options for selecting the model.
For views:
General views:
1. Form
We can select different types of components and fields, then drag and drop to the
needed places.
For selecting tabs we have drag and drop the tabs to the model. We can give names
and we can set the visibility to groups.
If we select the column, then we can add a name and we can set the visibility also.
Under the New fields section different types of fields are there. From these sections
we can choose different types of fields.
If we select the fields, under properties, we can change the properties field like
invisible, store etc. We can remove fields from models by clicking remove from view.
We can set the widget, default value, domain, and visibility to groups.
Text field: For this field you can set the conditions like invisible, required,
read only. You can set the label for the field. You can add help also. Under the
widget you can set the format of the field like if it is a text, then it looks like
the text field itself. You can set a default value for the field. You can set the
visibility to groups also. If you don’t want this field, you can remove it from
view.
In case of view you can create, edit or delete. If you set the field as invisible,
here you can enable the invisible element, then we can see it as a shaded portion.
Multiline text: In case of multiline text you can add the text to more than one
line.
Integer: You can add the integers, and default always shows it as zero.
Decimal field: You can add the decimal numbers.
HTML: HTML field looks like this.
Monetary field: If you want to add a monetary field, you have to add the currency
field first.
If you add the currency you can set the domain and context also
Monetary field always shows the cost and it is a decimal number.
Date, Date and Time: There are two fields available for date and datetime in Odoo
models.
Checkbox: Checkbox is a Boolean field, we can enable or disable these fields.
Selection fields: If you add the selection field you have to add the possible values
first.
Then you can edit the values also.
You can select the values in the given section.
File: You can upload pdf or any attachments over here
Lines: In lines you can edit the list view and form view also. You can add data
as line by line for a single section.
One 2 Many:
If you select the one2many field you have to add the relation, then you can edit
the form view or list view.
Many2One: If you drag and drop the many2one field, you have to
select the relation first like one2many field.
Many2many: For many2many also you have to add the relation first.
Image: If you select the image field, you can add the related images
as jpg files. You can also set the size of the image also.
Tags: Tag itself a many2many field, so you have to add the relation.
Priority: Priority will help to find the priority of data, we can
specify the possible values for priority by selecting the edit values.
Signature: This field used to add the electronic signature, you
have an option to autocomplete with contact, phone etc.
New Related Fields: You can relate fields by drag and drop into
the model. Here also you have to select the relation.
Existing Fields: Existing fields are already created fields and
if you want to add this into different views, you can drag and drop into particular
views.
Here you can see the product cost is available but which is not shown in Kanban
view.
We have a lot of existing fields are available.
After add the cost,
Similarly all fields which are already created available in existing fields. We
add these fields into new apps or Odoo available apps also.