odoo-shortcuts

Configuration

Odoo Shortcuts offers multiple configuration options to customize behavior according to your needs.

Configuration Panel
Panel Config Dark
Panel Config Light

⚙️ Accessing Settings

  1. Settings UI: Ctrl+, (Windows/Linux) or Cmd+, (Mac)
  2. Settings JSON: Open Command Palette → “Preferences: Open Settings (JSON)”

📋 Complete Configuration

Odoo Server Paths

Setting: odooShortcuts.odooServerPaths

Defines where Odoo source files are installed so the LSP can index them.

{
  "odooShortcuts.odooServerPaths": [
    "/home/user/odoo",
    "/home/user/enterprise",
    "/opt/odoo/odoo"
  ]
}

Note: These paths are used for autocomplete and code navigation.


Addon Detection

Core Addons: odooShortcuts.coreAddonPatterns

{
  "odooShortcuts.coreAddonPatterns": [
    "/odoo/addons/",
    "/odoo/odoo/addons/",
    "/openerp/addons/"
  ]
}

Enterprise Addons: odooShortcuts.enterpriseAddonPatterns

{
  "odooShortcuts.enterpriseAddonPatterns": [
    "/enterprise/",
    "/odoo/enterprise/"
  ]
}

Manifest Files

Setting: odooShortcuts.manifestFiles

Files that identify an Odoo addon.

{
  "odooShortcuts.manifestFiles": [
    "__manifest__.py"
  ]
}

Automatic Refresh

Setting: odooShortcuts.autoRefresh

{
  "odooShortcuts.autoRefresh": true
}

When enabled, the Odoo Explorer updates automatically when file system changes are detected.


CodeLens

Setting: odooFile.codelens.enabled

{
  "odooFile.codelens.enabled": true
}

Enables/disables CodeLens links on models and components.


File Headers

Enable Headers

Header License 1

{
  "odooShortcuts.fileHeaders.enabled": true
}

Author Information

Header License 2

{
  "odooShortcuts.fileHeaders.author": "Your Name",
  "odooShortcuts.fileHeaders.email": "your@email.com",
  "odooShortcuts.fileHeaders.company": "Your Company",
  "odooShortcuts.fileHeaders.license": "LGPL-3"
}

Available licenses:

Custom Template

{
  "odooShortcuts.fileHeaders.customLicense": "Copyright (c) 2024 Your Company. All rights reserved.",
  "odooShortcuts.fileHeaders.pythonTemplate": "# -*- coding: utf-8 -*-\n# Copyright  \n# License \n\n",
  "odooShortcuts.fileHeaders.xmlTemplate": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  Copyright  \n  License \n-->\n\n",
  "odooShortcuts.fileHeaders.javascriptTemplate": "/** @odoo-module **/\n// Copyright  \n// License \n\n"
}

Available variables:


File Opening

Setting: odooShortcuts.openFiles

{
  "odooShortcuts.openFiles": true
}

When enabled, generated files open automatically in the editor.


Shell Configuration

Setting: odooShortcuts.envFiles

{
  "odooShortcuts.envFiles": [
    "~/.zshrc",
    "~/.bashrc",
    "~/.bash_profile"
  ]
}

Shell configuration files to read environment variables from.


XML Formatter

See XML Formatter for detailed options.

{
  "odooShortcuts.formatter.tabSize": 4,
  "odooShortcuts.formatter.splitAttributes": false,
  "odooShortcuts.formatter.emptyElementHandling": "selfClosing",
  "odooShortcuts.formatter.preserveComments": true,
  "odooShortcuts.formatter.odooTagSpacing": true
}

📝 Complete Configuration Example

{
  // Odoo Shortcuts Configuration
  "odooShortcuts.odooServerPaths": [
    "/home/developer/odoo",
    "/home/developer/enterprise"
  ],
  "odooShortcuts.coreAddonPatterns": [
    "/odoo/addons/"
  ],
  "odooShortcuts.enterpriseAddonPatterns": [
    "/enterprise/"
  ],
  "odooShortcuts.autoRefresh": true,
  "odooShortcuts.openFiles": true,

  // CodeLens
  "odooFile.codelens.enabled": true,

  // File Headers
  "odooShortcuts.fileHeaders.enabled": true,
  "odooShortcuts.fileHeaders.author": "John Doe",
  "odooShortcuts.fileHeaders.email": "john@example.com",
  "odooShortcuts.fileHeaders.company": "My Company",
  "odooShortcuts.fileHeaders.license": "LGPL-3",

  // Formatter
  "odooShortcuts.formatter.tabSize": 4,
  "odooShortcuts.formatter.preserveComments": true,
  "odooShortcuts.formatter.odooTagSpacing": true
}

🎯 Workspace Configuration

You can have different configurations per project. VS Code saves them in .vscode/settings.json within your workspace.

// .vscode/settings.json
{
  "odooShortcuts.odooServerPaths": [
    "${workspaceFolder}/../odoo"
  ]
}

Next: Keybindings