Modeller, moduler och appar

Modeller bestämmer den logiska strukturen i en databas och hur data lagras, organiseras och manipuleras. Med andra ord är en modell en tabell med information som kan länkas till andra tabeller. En modell representerar vanligtvis ett affärskoncept, till exempel en försäljningsorder, kontakt eller produkt.

Moduler och appar innehåller olika element, t.ex. modeller, vyer, datafiler, webbkontrollanter och statiska webbdata.

Observera

Alla appar är moduler. Större, fristående moduler kallas vanligtvis appar, medan andra moduler vanligtvis fungerar som tillägg till dessa appar.

Föreslagna funktioner

När du skapar en ny modell eller app med Studio kan du välja att lägga till upp till 14 funktioner för att påskynda skapandeprocessen. Dessa funktioner buntar ihop fält, standardinställningar och vyer som vanligtvis används tillsammans för att tillhandahålla viss standardfunktionalitet. De flesta av dessa funktioner kan läggas till senare, men att lägga till dem från början gör modellskapandet mycket enklare. Dessutom kan dessa funktioner i vissa fall interagera med varandra för att öka deras användbarhet.

Example

När du skapar en modell med funktionerna Bild och Pipeline-stadier aktiverade läggs bilden till i kortlayouten för Kanban-vyn.

Kombination av funktionerna för bild- och pipelinefaserna i Kanban-vyn

Kontaktuppgifter

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

Funktion för kontaktuppgifter i formulärvyn

Tilldelning av användare

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

Funktion för användartilldelning i vyn Formulär

Datum och kalender

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

Datumintervall & 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.

Pipeline-stadier

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.

Observera

Funktionen Pipeline stages kan läggas till i ett senare skede.

Etiketter

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

Bild

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

Observera

Funktionen Picture kan läggas till i ett senare skede.

Linjer

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

Noter

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

Monetärt värde

Selecting Monetary value adds to the Form and Lista views a Monetary field. The Graf and Pivot views are also activated.

Observera

Ett Currency-fält läggs till och döljs från vyn.

Företag

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

Observera

Detta är bara användbart om du arbetar i en miljö med flera företag.

Anpassad sortering

Om du väljer Custom Sorting läggs en draghandtagsikon till i Listvy för att manuellt ordna om poster.

Example

Anpassad sorteringsfunktion i listvyn

Chatter

Om du väljer Chatter läggs Chatter-funktioner till i Formulärvyn (skicka meddelanden, logga anteckningar och schemalägga aktiviteter).

Observera

Funktionen Chatter kan läggas till i ett senare skede.

Example

Chatter-funktion i formulärvyn

Arkivering

Om du väljer Archiving läggs åtgärden Archive till i vyerna Form och Lista och arkiverade poster döljs som standard från sökningar och vyer.

Exportera och importera anpassningar

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.

Observera

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.

Tips

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.

Observera

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

Varning

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.