Modelli, moduli e app

I modelli determinano la struttura logica di un database e come i dati vengono salvati, organizzati e manipolati. In altre parole, un modello è una tabella di informazioni che possono essere collegate ad altre tabelle. Di solito, un modello rappresenta un concetto di business come ordini di vendita, contatti o prodotti.

I moduli e le app contengono vari elementi come modelli, viste, file di dati, controller web e dati web statici.

Nota

Tutte le applicazioni sono moduli. I moduli più grandi e indipendenti vengono chiamati app mentre altri moduli rappresentano componenti aggiuntivi delle stesse app.

Funzionalità consigliate

Quando crei un nuovo modello o una nuova app con Studio, puoi scegliere di aggiungere fino a 14 funzionalità per velocizzare il processo di creazione. Tali funzionalità legano campi, impostazioni predefinite e viste che di solito vengono utilizzati insieme per fornire alcune funzioni standard. La maggior parte delle funzioni possono essere aggiunte in seguito ma se fatto all’inizio, il processo di creazione del modello sarà più semplice. Inoltre, le funzioni interagiscono tra di loro, in alcuni casi, per aumentare l’utilità.

Example

La creazione di un modello con le funzionalità Immagine e Fasi del flusso attivate, comporta l’aggiunta dell’immagine nel layout della scheda della vista Kanban.

Funzionalità Immagine e Fasi del flusso nella vista Kanban

Dettagli contatto

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

Funzione Dettagli contatto nella vista modulo

Assegnazione utente

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

Funzionalità assegnazione utente nella vista modulo

Data e calendario

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

Intervallo date e 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.

Fasi del flusso

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

La funzionalità Fasi del flusso può essere aggiunta anche più tardi.

Etichette

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

Immagine

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

Nota

La funzionalità Immagine può essere aggiunta anche in seguito.

Righe

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

Note

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

Valore monetario

Selecting Monetary value adds to the modulo and Elenco views a Monetary field. The Grafico and pivot views are also activated.

Nota

Il campo Valuta viene aggiunto e nascosto nella vista.

Azienda

Selecting Company adds to the modulo and Elenco views a Many2One field linked to the Company model.

Nota

Utile solo se lavori in un ambiente con più aziende.

Ordinamento personalizzato

Se selezioni Ordinamento personalizzato, alla vista elenco verrà aggiunta un’icona per riordinare manualmente i record.

Example

Funzionalità ordinamento personalizzato nella vista elenco

Chatter

Selezionando Chatter, alla vista modulo verranno aggiunte le funzionalità del chatter (inviare messaggi, registrare note e programmare attività).

Nota

La funzionalità Chatter può essere aggiunta anche in seguito.

Example

Funzionalità Chatter nella vista modulo

Archiviazione

Se selezioni Archiviazione, alle viste modulo ed Elenco verrà aggiunta l’azione Archivia e i record archiviati verranno nascosti dalle ricerche e dalle viste.

Esportare e importare personalizzazioni

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.

Suggerimento

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

Avvertimento

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.