Skip to content

Quick start ​

Create a module, add files, and write code with snippets, suggestions and inspection in Odoo Helper for PyCharm. Install the plugin first.

On macOS, use Cmd in place of Ctrl in the shortcuts on this page.

What you can do ​

Create a module ​

  1. Right-click a folder that is in the addons path of your odoo.conf.
  2. Select Odoo Developer Tools > Odoo Module Templates.
  3. Choose a template.
  4. Enter the module name and press Enter.
TemplateUse it for
Basic Module TemplatePrototypes, learning and simple modules.
Advanced Module TemplateProduction modules and team projects.
Basic Owl TemplateSimple widgets, buttons and UI enhancements.
Owl Advance Module TemplateInteractive dashboards and client features.
Website Theme Module TemplateReusable website themes and design components.
Systray Icon ModuleNotifications, quick actions and systray utilities.

The module includes __init__.py, __manifest__.py and, depending on the template, models, views, security and demo data. See Module templates for the generated structure of each template.

Odoo Developer Tools menu in PyCharm listing the six module templates with their shortcuts

Add files ​

  1. Right-click a folder in your module.
  2. Select Odoo Developer Tools > New Odoo File, then Create Odoo Python File, Create Odoo XML File or Create Odoo Access File.
  3. Enter a file name and choose a template.
File typeTemplates
Python__init__.py, __manifest__.py, Odoo Model, Odoo Controller
XMLEmpty, Basic, Advanced, Inherit, Report, Security Group, Security Rule, Sequence, Settings, Cron Job
CSVSecurity access (ir.model.access.csv)

New files are registered in __init__.py or __manifest__.py for you. See File creator.

New Odoo File submenu in PyCharm with Create Odoo XML File and Create Odoo Python File

Create OWL components ​

Right-click a valid Odoo module and select Odoo Developer Tools > Owl Components. Choose one of four items:

ItemCreates
Create Common WidgetA common OWL component.
Create Field WidgetAn OWL component you can use as a field widget.
Create Public WidgetAn OWL component registered in the public component category, for use in Odoo templates.
Create Owl ServiceA basic OWL service.
Owl Components submenu in PyCharm with the four Create items

Extend POS screens ​

Right-click a valid Odoo module and select Odoo Developer Tools > POS Components > Extend Screens. Choose the screen to extend:

ScreenUse it to
Receipt ScreenCustomize the receipt layout and content.
Product ScreenModify product selection and display.
Payment ScreenAdd or change payment methods and interactions.
Partner List ScreenExtend customer management and selection.
Ticket ScreenCustomize order management and ticket display.
POS Components submenu in PyCharm listing the Extend Screens options

Write code with assistance ​

  • Type odoo in a Python or XML file to insert a snippet. See Snippets.
  • Press Ctrl+Space for suggestions of model names, field names, template names, widgets and manifest dependencies. Press Tab to accept and Esc to dismiss. See Smart suggestions.
  • Review the inspection warnings in the editor and apply quick fixes. See Code inspection.

Get started: your first module ​

  1. Install and verify. Install the plugin, restart PyCharm, let indexing finish, then type odoo in a Python file to check that snippets appear.
  2. Create the module. Right-click your addons folder, choose Odoo Developer Tools > Odoo Module Templates > Basic Module Template, and enter a descriptive name such as my_first_module. Review the generated models, views, security and manifest files.
  3. Add files. Right-click models/ and create an Odoo Model. Right-click views/ and create a Basic XML view. The imports and the manifest data entries are added for you.
  4. Add security. Create an Odoo Access File for access rights, or an XML Security Group and Security Rule for groups and record rules.
  5. Write code. Use snippets for fields, computed fields, onchange methods and actions. Use suggestions to pick model and field names.
  6. Check and test. Review inspection warnings and apply quick fixes. Then install the module in Odoo and test it.
  7. Move on. Try the Advanced, OWL, Theme and Systray templates, and other view types such as search, kanban, calendar and pivot.

Keyboard shortcuts ​

ActionWindows and LinuxmacOS
Create Basic ModuleCtrl+Shift+BCmd+Shift+B
Create Advanced ModuleCtrl+Shift+DCmd+Shift+D
Create Website Theme ModuleCtrl+Shift+WCmd+Shift+W
Create Owl Basic ModuleCtrl+Shift+OCmd+Shift+O
Create Owl Advanced ModuleCtrl+Shift+LCmd+Shift+L
Create Systray Icon ModuleCtrl+Shift+SCmd+Shift+S
Create Odoo Python FileAlt+Shift+DCmd+Shift+D
Create Odoo XML (view) FileAlt+Shift+VCmd+Shift+V
Create Odoo Access FileAlt+Shift+ACmd+Shift+A
Open Odoo File Creation MenuAlt+Shift+FCmd+Shift+F

To change a shortcut, see File creator.

Tips and limits ​

Module layout

A typical Odoo module keeps each kind of file in its own folder:

text
module_name/
├── __init__.py
├── __manifest__.py
├── models/       # one file per model, plus __init__.py
├── views/        # XML views, grouped by feature
├── security/     # ir.model.access.csv and security.xml
├── data/         # data and demo XML
├── controllers/
└── static/
    ├── description/icon.png
    └── src/      # js, scss and xml assets

Naming

  • Use lowercase names with underscores for Python files, such as sale_order.py, and one file per model or closely related group of models.
  • Use descriptive names for XML files, grouped by function, such as sale_views.xml.
  • Keep security files separate and use the standard names ir.model.access.csv and security.xml.

Working habits

  • Start from the Basic module to learn the structure, then move to the Advanced and OWL templates.
  • Create model files in models/, controllers in controllers/ and view files in views/. The file creator only offers templates that suit the folder you pick.
  • Use snippets for common patterns instead of typing them from scratch, and use suggestions to discover the models and fields that exist.
  • Fix inspection warnings as they appear, and review generated code before you commit it.
  • Add docstrings to models and methods, and write tests for your module.
  • Odoo conventions for module layout and naming are in the Odoo coding guidelines.

Next steps ​

Built by Cybrosys Technologies.