Axelor Doc

Field not stored in database

Definition in the view

Sometimes we need to add fields to the form, which do not exist in the object. This can be achieved with the attribute widget .

<- Added a boolean field ->
<field name="dummy1" widget="BOOLEAN" title="Boolean Field"/>

<- Adding an integer field with a constraint ->
<field name="dummy2" widget="INTEGER[minSize=10|maxSize=20]" title="Integer Field"/>

<- Added a M2O ->
<field name="dummy3" widget="MANY_TO_ONE[target=com.axelor.contact.db.Title|targetName=name]" title="M2O Field"/>

The format of the attribute widget is as follows:

(Type) ([attr = value (| (attr = value)) ])?*

The type can be any of the following:

  • BOOLEAN
  • INTEGER
  • DECIMAL
  • LONG
  • DATE
  • TIME
  • DATETIME
  • MANY_TO_ONE
  • ONE_TO_MANY
  • MANY_TO_MANY

Default type is a STRING.

These are the types "server." If you want to specify an alternate widget, such MasterDetail, then the "real server" type must be passed as an attribute. Example:

<field name="dummy" widget="MasterDetail[type=ONE_TO_MANY|target=com.axelor.contact.db.Title|targetName=name]" title="Master Detail"/>

All other attributes supported by the tag field can be specified normally (for example, the attribute title ).

Dummy fields added in this way are not saved in the database. Values are passed to the context as a value chain or dictionary. They are not converted to their actual types are therefore not available on the server side.