Form View Attributes in Odoo 16

HISHAM
October 16, 2023
form-view-attributes-in-odoo
Understanding and exploiting Form Attributes in Odoo 16 is one of the key elements of customizing your experience in Odoo. Your data forms’ form attributes act as their building blocks. They control how you work with your data, including whether you add new ones, alter current ones, duplicate them, or even get rid of them.

We’ll examine these crucial qualities in more detail in this blog.

1. Create: This element specifies whether the form view should have the “Create” option. The user won’t be allowed to add new records using this form view if the value is false. By default, this property will always be true. 2. Write: The availability of the “Save” and “Edit” options is determined by this characteristic. The user won’t be allowed to edit current records using this form view if the value is false. It is initially set to true. 3. Edit: If utilized, this attribute determines whether the view is editable. The write property and this are comparable. It is initially set to true. 4. String: The string attribute is used to define a human-readable title or label for the form view. This label is typically displayed at the top of the form to give users context about the data they are working with. 5. js_class: This attribute specifies the JavaScript class to be applied to the form view. It can be used to attach custom JavaScript behavior to the form view. 6. Duplicate: This attribute is used to determine whether the “Duplicate” option is available. Users can create duplicates of the current record if required. By default, this attribute will be true. If set to false, users won’t be able to create duplicates of the current record using this form view. 7. Delete: This attribute is used to determine whether the “Delete” option is available. By default, this attribute will be true. If set to false, users won’t be able to delete the current record using this form view. By default, without setting any form attributes, we have the option to create a new record, edit, delete, and duplicate it.

In the below code, we haven’t specified any attributes.

In this case, we can see the option ‘New’ at the top right corner of the Form view to create a new record, and also the option to delete and duplicate the record, under the ‘Action’ menu. Additionally, the option to edit the record is also available.
If you want those attributes to be disabled, you can set them to 0 as follows:
As we can see, there are no possibilities to create, modify, remove, or duplicate in this situation.
Using these properties in your form view definitions will allow you to finely control the user experience by deciding which actions users can take on records. Understanding and wisely applying these features will enable you to customize Odoo to your specific business requirements, ensuring an effortless and efficient workflow for users.

"Unlock the Full Potential of Your Business with Odoo ERP!"

"Get a Cost Estimate for Your ERP Project, Absolutely FREE!"

Get a Free Quote

Leave a Reply

Your email address will not be published. Required fields are marked *