Loading basic data of odoo

Keywords: Javascript xml Database

Loading basic data of odoo

There are two ways to load the basic data of odoo, one is to demonstrate the data loading, the other is to load the default data. The following is a detailed introduction

First, of course, create a date Folder

  • Project directory, right click to customize a folder

XML data definition format

    <record id="building_type0" model="building.document.folder">
        <field name="name">Party Committee document of bureau group</field>
    </record>

    <record id="activity_type1" model="building.document.folder">
        <field name="name">General branch document</field>
    </record>

     <record id="building_type2" model="building.document.folder">
        <field name="name">Branch file</field>
    </record>
  • Fill in the "name" value of modelclass in the model
  • The id is filled with the external identifier, which is the unique identifier used to mark a database record in the odoo
  • Note: you can view all external identifiers in the web settings.

Internal field is to define the column name and value of a specific record. There can be multiple columns, as follows:

    <record id="documents_hr_documents_facet" model="documents.facet">
        <field name="name">Documents</field>
        <field name="sequence">6</field>
        <field name="folder_id" ref="documents_hr_folder"/>
    </record>

     <record id="documents_internal_template_facet" model="documents.facet">
        <field name="name">Templates</field>
        <field name="sequence">6</field>
        <field name="folder_id" ref="documents_internal_folder"/>
     </record>

The data file must be listed in the "manifest". Py data or demo field to load correctly after the module is installed and updated

'data': [
    'security/security.xml',
    'security/ir.model.access.csv',
    'assets.xml',
    'views/views.xml',
    'views/templates.xml',
    'data/building_data.xml',
],

# 
'demo': [
    'demo/demo.xml',
],
  • demo data only loaded in demonstration mode
  • Data data will be loaded automatically after the system is started (always loaded)

Posted by spectacell on Thu, 05 Dec 2019 20:19:46 -0800