Creating a Wizard to generate a Dynamic Field in Odoo

  • Odoo ERP

  • Published OnApril 16, 2021

  • Updated On November 15, 2022

Featured Image
Creating a Wizard to generate a Dynamic Field in Odoo

How to create wizards for creating dynamic fields Creation 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.

[Also read: 10 New features of Odoo 15 that will entice you to upgrade]

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.

What are the Benefits of creating dynamic fields in Odoo?

  • 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.

What are the 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.

How to 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. 

[Also read: How to Choose the Right Odoo Partner for Your Business?]

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.
If you are looking for the right Odoo Migration Company to take your business to the next-level, contact Brainvire today.

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, you need to 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.

[Also read: How to Transfer Files Securely and Quickly with SCP

Conclusion:

Brainvire, one of the leading Odoo ERP development services, can build a customized module and create dynamic fields in Odoo for your business. 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.

FAQs

What is a wizard in Odoo?

Wizards are interacting tools with dialogue boxes used to enhance user experience. There are two primary types of wizard models: Abstract and Transient. While the Abstract Model is the base of most Odoo models with a long-term database, the Transient Model is determined by the type’s transitional data structure.

What is the transient model in Odoo?

The Transient Model in Odoo is a type of wizard used for interactions to enhance user experience. Unlike a long-term database in the Abstract Model, the Transient Model is determined by the type’s transitional data structure. As a result, the information stored is temporary, brief, and periodically updated.

How to Create & Manage Wizard in the Odoo 15?

1. First, download the compressed record of the Transient Module.
2. Create a wizard using the “(models.TransientModel)” function.
3. This will open a wizard view in a new popup window. It can be triggered using a menu item or a button action.
4. The special attribute “cancel” is used by wizards to close the window without saving.
5. You can add a button and action to the button in the wizard using the “def action_” command.
6. To open a wizard using a button, you can use either an XML or a python code. 
7. You can now write the return action for creating the wizard and add the action to the main menu with the <menuitem id> command.

What is the Dynamic field in Odoo?

The Dynamic field is a user-friendly module that you can use to add or remove any field and give a unique user group access. The user does not require any technical experience to use this.

    Looking to move to the cloud?

    Let our extended team be part of your journey and help you.

    Chirag Jogi
    About Author
    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.

    Related Articles

    • Odoo ERP - Brainvire
      Why is Odoo ERP A Perfect Fit for Your Business?

      Talking About Why is Odoo ERP A Perfect Fit for Your Business? You might be running here and there to hunt individual software solutions or applications for your organization’s sales,

    • Looking for Real Estate Management Solution Let Us Help You Out
      Why Odoo ERP Is The Best Solution For Real Estate Management

      The real estate industry has evolved by several folds over the past decade. Gone are the days when operations in the industry were streamlined and would require minimal overview.  Over

    • Odoo Stand TOP in OWSAP Security
      8 Reasons Why Odoo Is the Most Secure Platform According to OWASP

      The conventional ERP sector is reluctant to accept public discussions regarding security, frequently implying that it is a platform issue rather than that of an application. As a result, developing