Package: odoo-configurator
odoo-configuratorOdoo Configurator simplifies and automates the configuration of Odoo using YAML files.
It allows you to update the database, install/update/uninstall modules, configure settings,
manage users, and perform various data manipulation operations.
It is an essential tool for Odoo administrators looking to streamline their configuration workflow.Installationpip install odoo-configuratorUsageodoo-configurator ./work_dir/project_name.local.ymlTo run a configuration from the source code:/odoo-configurator/start_config.py ./work_dir/project_name.local.ymlProvided file must contain the auth/odoo section to set connexion parameters.project_name.local.ymlname: project_name local

    inherits:
        - ../work_dir/project_name/project_name.yml

    auth:
        odoo:
            url: http://project_name.localhost
            dbname: project_name
            username: admin
            password: admin123InheritsInherits param provide a list of configuration files witch content is merged before execution.inherits:
        - ../work_dir/project_name/sales.yml
        - ../work_dir/project_name/account.ymlScript FilesScript Files param provide a list of configuration files witch content will be executed sequentially.script_files:
        - ../work_dir/project_name/script1.yml
        - ../work_dir/project_name/script2.ymlParametersInstall Mode: To import datas with the valueon_install_only: Trueadd the "--install" parameter in command
line:./start_config.py ./clients/name/name.local.yml --installEnvironment variablesSome parameters can be provided by environment variable.Use ODOO_URL, ODOO_DB, ODOO_USER and ODOO_PASSWORD instead of using auth/odoo params in config fileUse KEEPASS_PASSWORD instead of --keepass command line parameterPre UpdateTo prepare a configuration or add a fix use "pre_update", the given scripts will be executed before the normal configuration.pre_update:
        - ../exemple/exemple.pre_update_script.ymlModulesTo install modules use "modules"base:
      modules:
        - example_moduleTo update modules use "updates"base:
      updates:
        - example_moduleTo uninstall modules use "uninstall_modules"base:
      uninstall_modules:
        - example_moduleSet config parameters (Settings)to set the value of a setting (res.config.settings)settings:
      config:
        group_use_lead: TrueFor a specific company configuration use thecompany_idparameter:settings main_company:
      config:
        company_id: get_ref("base.main_company")
        chart_template_id: get_ref("l10n_fr.l10n_fr_pcg_chart_template")
        context: { 'lang': 'fr_FR' }A context can be passed to the config command.Set system parametersto set the value of a system parameter (ir.config_parameter)Company System Parameters:
  system_parameter:
    Mail Default From Filter:
      key: mail.default.from_filter
      value: my-company.comCreate or update recordsIf the record with the xml id provided with force_id don't exist, the record will be created.Records to create:
        datas:
            My record 1:
                model: res.partner
                force_id: external_config.partner_1
                values:
                    name: Partner 1
                    ref: PARTNER1
            My record 2:
                model: res.user
                force_id: base.user_admin
                values:
                    name: Admin UserLoad recordsUsing load parameter will speed up creation and update of record compared to single record update.Records to load:
        load: True
        model: res.partner
        datas:
            My record 1:
                force_id: external_config.record1
                values:
                    name: Record 1
                    ref: REC1
            My record 2:
                force_id: external_config.record2
                values:
                    name: Record 2
                    ref: REC2Update records with a domainTo update values of multiple records, set a domain with "update_domain" :Update Example:
      model: res.partner
      update_domain: "[('email','=','example@test.com')]"
      values:
        name: ExampleAvailable functionsAll functions in OdooConnection starting byget_are callable from yml files.get_refget_image_urlget_image_localget_local_fileget_countryget_menuget_search_idget_xml_id_from_idget_recordThese functions can be nested by using the o object:Ir model Data Config:
  datas:
    Add employee document xmlid:
      model: ir.model.data
      force_id: template_01_employee_01
      values:
        model: paper.paper
        module: external_config
        name: template_01_employee_01
        res_id: get_search_id('paper.paper', [
                ('template_id', '=', o.get_ref('external_config.template_01')),
                ('res_id', '=', o.get_ref('external_config.employee_01'))
                ], 'desc')Server Actions and FunctionsTo call a model function:001 Call Function:
      datas:
        Call Function:
          function: example_function
          model: res.parnter
          res_id: get_ref("base.partner_demo")
          params: ['param1', param2]
          kw: {'extra_param1': get_ref('external_config.extra_param1')}To call an action server (ir.actions.server):002 Call Action Server:
      datas:
        Call Action Server:
          action_server_id: get_ref("custom_module.action_exemple")
          model: res.parnter
          res_id: get_ref("base.partner_demo")UsersTo set groups on a user you can remove previous groups with "unlink all":users:
        datas:
            User Example:
                model: res.users
                force_id: base.user_example
                values:
                    name: Example
                    login: example@test.com
                groups_id:
                    - unlink all
                    - base.group_portalOther data toolsdelete_alldelete_domaindelete_iddeactivateactivateupdate_domainsearch_value_xml_idthis option allows to pass an id from xml_id to a domainCan be used with update_domain, activate, deactivate:Deactivate Partner Title doctor:
                  model: res.partner.title
                  search_value_xml_id: base.res_partner_title_doctor
                  deactivate: "[('id', '=', search_value_xml_id)]"TranslationsTo set the translation of a translatable field, use thelanguagesoption.
Example:Mail Templates:
        datas:
            Notification:
                model: mail.template
                force_id: mail.notification_template
                languages:
                    - fr_FR
                    - en_US
                values:
                    body_html: |
                        <table>
                            <tbody>
                            Text for french and english
                            </tbody>
                        </table>Mattermost NotificationTo set a Mattermost url and channel where to send notifications:mattermost_channel: my-channel
    mattermost_url: https://mattermost.xxx.com/hooks/dfh654fghTo avoid Mattermost notification, add in main yaml file:no_notification: TrueKeepassKeepass is a tool to store and protect passwords.Available functions to use stored values in Keepass:password: get_keepass_password('path/passwords.kdbx', 'Folder Name', 'Key Name')
    user: get_keepass_user('path/passwords.kdbx', 'Folder Name', 'Key Name')
    url: get_keepass_url('path/passwords.kdbx', 'Folder Name', 'Key Name')To avoid to repeat path and group in Keepass functions, you can setkeepass_pathandkeepass_groupkeepass_path: path/passwords.kdbx
keepass_group: Folder Name

my_secret: get_keepass_password('Key Name')3 ways to pass the Keepass password to odoo-configurator :Provide Keepass password with the keepass parameter in command line:--keepass='mdp***'Set theKEEPASS_PASSWORDenvironment variableManually. If it's required odoo-configurator will ask to type the password with the promptKeepass Password:In PyCharm, to type the Keepass password, please check theEmulate terminal in output consoleoption in your run/debug configuration.BitwardenBitwarden is a tool to store and protect passwords. Make sure Bitwarden CLI is installed.Credentials to connect to Bitwarden Vault can be set by environment variables, please report to thes6r-bitwarden-cli documentationAn over option is to set the value ofbitwarden_usernameandbitwarden_passwordin yml file. Obviously, do not save password directly in your yml file, use Keepass functions for example.bitwarden_username: get_keepass_user('Bitwarden')
bitwarden_password: get_keepass_password('Bitwarden')Standard CSV ImportColumns in the CSV file must be the technical name of the field.
A column "id" is required to allow update of datas.In yml file:import_data:
        import_csv Product Template:
            on_install_only: True
            model: product.template
            name_create_enabled_fields: uom_id,uom_po_id,subscription_template_id
            file_path: ../datas/todoo/product.template.csv
            specific_import: base/import_specific.py
            specific_method: import_partner
            batch_size: 200
            skip_line: 1420
            limit: 100
            context: {'install_mode': True}Required fields:modelfile_pathOptional fields:name_create_enabled_fields: List of the fields which are allowed to "Create the record if it doesn't exist"on_install_only: Do the csv export only inInstall Modecontext: Provide a specific context for importsspecific_import: Path to a specific Python filespecific_method: Import method to use form the filespecific_importbatch_size: Number of records by load batchlimit: Maximum number of record to importskip_line: index of the record to start withGenerate YML data file from a modelThis configuration will generate a res_partner.yml file in theconfigdirectoryActions:
    import_configurator_model_file:
        Portal Form:
            model: res.partner
            domain: [['is_company', '=', True]]  # Don't use parenthesis in the domain
            order_by: name, ref
            force_export_fields: ["email_formatted", "country_code"]
            excluded_fields: ["email", "country_id"]Release ConfigurationSome configurations need to be executed on every platform until the production release. After that we need to archive these configuration files.
We will store the files in the directoryrelease_configfor example.
To run all these files, add therelease_directoryparameter in your main configuration file:release_directory: ./release_configTo back up the release files after the execution of the production configuration, add theclear_release_directoryparameter in you production configuration file.clear_release_directory: TrueContributorsDavid HalgandMichel Perrocheau -GithubMaintainerThis software was created byHodeiformerly Teclib' ERP,
maintenance is now being handled byScalizer.