Creating a Wizard to generate a Dynamic Field in Odoo6 min read

author
Chirag Jogi

Delivery Head

4.9
(541)
Creating a Wizard to generate a Dynamic Field in Odoo

This blog will go into how to create wizards for creating dynamic fields in Odoo.

First and foremost, let’s discuss wizards.

Wizards are used to interacting with dialogue boxes in Odoo. 

In Odoo, there are primarily two types of wizard models available: 

Abstract Model: The model class is the base of the vast majority of Odoo models. Furthermore, it has a long-term database, as shown by the fact that the data stored in the table rendered is accurate.

Transient Model: This is determined by the type’s transitional Data structure. Furthermore, the information stored in the data set is brief in this class, and information from the data set table is periodically fixed up.

Odoo uses a transitory/transient model in which data is saved temporarily and data in the wizard requires only temporary storage. following are the qualities of the transient model:

  • Data in the wizard can allude to standard records or many2one fields, but normal records cannot allude to many2one fields or wizard data.
  • Since data in the wizard needs only minimal storage, they are retransmitted after some time.
  • On wizard data, clients have all consents; they do not need direct access rights.

Readers from any business can have a better understanding of the next level if they consider the above details of wizards.

Since the readers are also students, we will first go over the Odoo Module, highlights, latest highlights, and installation before going over how to create wizards to create dynamic fields in Odoo.

This module can be used to create dynamic fields in an errand that does not require high performance. It is simple when using. Demonstration of the highlights, features, and fields that are part of the system.

Have a Project Idea?

Want to convert your idea into a successful app or website? Schedule your free call with our expert now.

Highlights

  • User -friendly 
  • The user doesn’t require any technical experience.
  • It is easy to add and remove any field.
  • It is easy to give a unique user group access to any field.
  • It is simple to add a custom tab to Task Form View.
  • On the Task Form view, add a custom area.
  • Use an image widget for the binary field.
  • Tags or checkboxes widgets are used in a variety of areas.
  • Help text, a necessary field, and a replicated field are also noteworthy features.
  • A radio widget for a related field.
  • For scorch fields, there is a phone, URL, and email gadget.
  • There are numerous field types available.
  • The widget is also available for one2one and many2many fields.
  • Some to one field selection widget.
  • It is simple to indicate the position of fields.

Latest Odoo Features

  • A binary widget has been added with Many-2-Many feature
  • A float time widget has been added to the hourly and minutely follow time.
  • An HTML widget has been added to the text area, which will be useful for viewing an HTML interface.
  • This feature was added to meet a requirement.

Add on feature for the new version (1.0.3)

  • It is simple to add a custom tab to the Task type view.

Installation Pattern:

> If it’s not too much hassle, you’ll be given a link to download the compressed record of the module.

> When you open the compressed folder, you will see the folder ‘bv_task_custom_fields.’

> Control V and Control C to insert this folder into your Odoo Custom Widget Path.

> Now, start Odoo in Developer Mode.

> Go to the Apps menu and select ‘Update Modules List,’ then press the Update button.

> Check for ‘bv_task_custom_fields’ in the search bar.

Odoo is an open-source program that provides nearly all fields available for express convenience. Regardless, in some market situations, we must add fields and retry in the same manner. It is difficult to create a field from code from the perspective of the end-user. So here is the requirement for constructing Dynamic fields in Odoo. 

Now let’s see Brainvire’s dynamic field creation in Odoo.

Referring to the above-mentioned features and installation would be useful in the understanding of the method.

Initially, we created the following wizards to create a dynamic field:

To demonstrate the field’s types, we applied, selection=get_possible_field_types to the field, field_type, and the process get_possible_field_types is as follows:

In this view, each field has an alternative widget, including many2many tags, radio, and so on.

We have a method for changing the field type that is described below in order to return the widget based on the field type:

The view on the widget is as follows, ie, wizard.xml:

The following is the output:

To build the field, use the following method:

In this model, the wizard includes a render field button, and when that button is clicked, the technique create_fields is executed.

The following is the output:

Conclusion:

Brainvire, one of the leading Odoo ERP development services, can build a customized module and create dynamic fields in Odoo for your business. Please connect with us, if you have any issues related to the current Odoo features, creating wizards, or for the Odoo open-source development model. Excellent Reading.

About Chirag Jogi

Chirag has worked with companies of all sizes, helping them use Odoo ERP to its fullest potential. With his expertise in Odoo ERP and years of experience working as a consultant, there isn’t anything that he cannot do for your company. He can help you take full advantage of this powerful tool so you can boost your business growth. To catch up on Odoo ERP and its impact on your business, connect with Chirag today.

Lets Connect!

How useful was this post?

Click on a star to rate it!

Average rating 4.9 / 5. Vote count: 541

No votes so far! Be the first to rate this post.