Modelos, módulos y aplicaciones

Los modelos determinan la estructura lógica de una base de datos y cómo se almacenan, organizan y manipulan los datos. En otras palabras, un modelo es una tabla de información que se puede vincular con otras tablas. Un modelo suele representar un concepto empresarial, como una orden de venta, un contacto o un producto.

Los módulos y las aplicaciones contienen varios elementos, como modelos, vistas, archivos de datos, controladores web y datos web estáticos.

Nota

Todas las aplicaciones son módulos. Los módulos más grandes e independientes suelen denominarse aplicaciones, mientras que otros módulos suelen ser complementos de dichas aplicaciones.

Funciones sugeridas

Cuando se crea un nuevo modelo o aplicación con Studio, se puede optar por añadir hasta 14 funciones que permitan acelerar el proceso de creación. Estas características agrupan campos, configuraciones predeterminadas y vistas que suelen utilizarse en conjunto para proporcionar cierta funcionalidad estándar. La mayoría de estas funciones se pueden añadir después, pero añadirlas desde el principio facilita mucho el proceso de creación del modelo. Además, en algunos casos, estas funciones interactúan entre sí para aumentar su utilidad.

Example

La creación de un modelo con las funciones Foto y Etapas del flujo activadas añade la imagen en el diseño de la tarjeta de la vista Kanban.

Combinación de las funciones de las etapas imagen y flujo en la vista kanban

Detalles de contacto

Selecting Contact details adds to the Form view a Many2One field linked to the Contact model and two of its Related Fields: Phone and Email. The Contact field is also added to the List view, and the Map view is activated.

Example

Función de datos de contacto en la vista de formulario

Asignación de usuario

Selecting User assignment adds to the Form view a Many2One field linked to the Contact model, with the following Domain: Share User is not set to only allow the selection of Internal Users. In addition, the many2one_avatar_user widget is used to display the user’s avatar. The Responsible field is also added to the List view.

Example

Función asignación de usuarios en la vista de formulario

Fecha y calendario

Selecting Date & Calendar adds to the Form view a Date field and activates the Calendar view.

Rango de fechas y Gantt

Selecting Date range & Gantt adds to the Form view two Date fields next to each other: one to set a start date, the other to set an end date, using the daterange widget, and activates the Gantt view.

Etapas del flujo

Selecting Pipeline stages activates the Kanban view, adds several fields such as Priority and Kanban State, and three stages: New, In Progress, and Done. The Pipeline status bar and the Kanban State field are added to the Form view. The Color field is added to the List view.

Nota

Se puede añadir la función Etapas del flujo después.

Etiquetas

Selecting Tags adds to the Formulario and Lista views a Tags field, creating a Tag model with preconfigured access rights in the process.

Foto

Selecting Picture adds to the top-right of the Form view an Image field.

Nota

Se puede añadir la función Imagen después.

Líneas

Selecting Lines: adds to the Form view a Lines field inside a Tab component.

Notas

Selecting Notes adds to the Form view an Html field using the full width of the form.

Valor monetario

Selecting Monetary value adds to the Formulario and Lista views a Monetary field. The Gráfica and Tabla dinámica views are also activated.

Nota

Se añade y oculta un campo de Divisa de la vista.

Empresa

Selecting Company adds to the Formulario and Lista views a Many2One field linked to the Company model.

Nota

Esto solo es útil en un entorno multiempresa.

Orden personalizado

Si selecciona Orden personalizado se añadirá un icono de arrastre que le permitirá ordenar de forma manual los registros en la vista de Lista.

Example

Función de orden personalizado en la vista de lista

Chatter

Si selecciona Chatter se añadirán las funciones de Chatter (envío de mensajes, registro de notas y programación de actividades) a la vista de Formulario.

Nota

Se puede añadir la función Chatter después.

Example

Función de chatter en la vista de formulario

Archivando

Si selecciona Archivando, se añadirá la acción Archivando a las vistas Formulario y Lista. Esto hará que se oculten los registros archivados de las búsquedas y vistas de manera predeterminada.

Exportar e importar personalizaciones

When you do any customization with Studio, a new module named studio_customization is added to your database. You can export this module as a ZIP file using the Studio Export function. The module can then be imported into another Odoo database. This may be useful, for example, when setting up a new module or for training purposes.

Nota

Exporting and importing customizations in this way, rather than using the standard Odoo export and import functions, means data is imported in a logical way. For example, if the module contains customers and sales orders, the customers are created first, since these are required for the sales orders to be created.

Export customizations

To export customizations, click the (Toggle Studio) button on the main Odoo dashboard, then Export, then either:

Configure data to export

To select specific models to export, click New on the Studio Export screen, then start typing the name of the relevant model or select it from the list.

Truco

Click Preset to see a list of all models in your database with records that have been modified using Studio and all custom models created using Studio. To configure one of these models for export, click on the model to open it and make the required changes.

Tick the following options as relevant:

  • Demo: if the exported records should be considered as demo data when imported.

  • Attachments: if attachments related to exported records should be included in the export.

  • Updatable: if the exported records should be able to be updated during a module update.

If necessary, edit the Domain to determine which of the model’s records should be exported. To do so, click the Edit Domain button or (Modify filter) then Edit Domain, as appropriate. Proceed to make any required changes.

After configuring a model for export, click Studio Export to return to the main screen. To download a ZIP file with the customizations for all the listed models, click Export.

Nota

It is not necessary to select one or more models as all listed models will be included in the export. To remove a model from the export, select it and click the Actions button then Delete.

In the Studio Export window:

  • leave the checkboxes unticked to export only the customizations done with Studio.

  • tick Include Data to include data from the selected models in the export.

  • tick Include Demo Data to include data from the selected models that is flagged as demo data. Ticking this option also ticks Include Data.

Click the Export button to download the ZIP file.

Choosing to export both data and demo data

Import customizations

Advertencia

Before importing, make sure the destination database is on the same Odoo version and contains the same apps and modules as the source database. Studio does not add the underlying modules as dependencies of the exported module.

To import and install Studio customizations in another Odoo database:

  1. Connect to the destination database.

  2. Click the (Toggle Studio) button on the main Odoo dashboard, then Import.

  3. Upload the exported ZIP file. If demo data should be imported, tick Load demo data.

  4. Click Install.