Odoo Snippets 🐍
Features
InstallationFrom VS Code Marketplace
From VSIX (Manual)
Python Snippets
Example —
|
| Prefix | Description |
|---|---|
oform |
Complete Form View record |
otree |
Tree / List View record |
okanban |
Kanban View record |
osearchview |
Search View with filter and group by |
oaction |
ir.actions.act_window record |
omenu |
menuitem tag |
obtnheader |
Header with button and statusbar widget |
osmartbtn |
Smart Button (oe_stat_button) |
onote |
Notebook with page tab |
ogroup2 |
Two-column group layout |
oinherit |
View inherit with XPath |
ochatter |
Chatter widget (message, activity, follower) |
omodulexml |
Base XML file wrapper (<odoo><data>) |
Example — oform
Type oform and press Tab:
<record id="sale_order_form_view" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<form string="Sale Order">
<sheet>
<group>
<field name="name"/>
<!-- cursor lands here -->
</group>
</sheet>
</form>
</field>
</record>
Example — oinherit
Type oinherit and press Tab:
<record id="sale_order_form_view_inherit" model="ir.ui.view">
<field name="name">sale.order.form.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<!-- cursor lands here -->
</xpath>
</field>
</record>
How to Use
- Open a Python or XML file in VS Code
- Type the snippet prefix (e.g.
omodel) - Press Tab or Enter to expand
- Use Tab again to jump between placeholders
- Fill in your values and you're done!
💡 Pro Tip: Type
oto see all available Odoo snippets in the IntelliSense dropdown at once!
Requirements
- VS Code
1.60.0or higher - Compatible with Odoo
14.0,15.0,16.0,17.0, and19.0
Extension Settings
This extension does not add any VS Code settings.
Author
Aman Kumar Singh
- GitHub: @amankum02
- LinkedIn: Aman Kumar Singh
- Email: as2732044@email.com
Contributing
Contributions are welcome! If you want to add new snippets or fix a bug:
- Fork this repository
- Create a new branch:
git checkout -b feature/my-snippet - Add your snippet to
snippets/python.jsonorsnippets/xml.json - Submit a Pull Request
When submitting a snippet, please include:
- A clear
prefix - A helpful
description - Proper
$1,$2tab stops
Snippet Format Reference
"Snippet Name": {
"prefix": "oprefix",
"body": [
"line one ${1:placeholder}",
"line two ${2:placeholder}",
"${0}"
],
"description": "Short description of what this snippet does"
}
Changelog
0.0.1 — Initial Release
- Python model, field, compute, and onchange snippets
- XML form, tree, kanban, and search view snippets
- Button, action, and menu snippets
- View inheritance (XPath) snippet
- Smart button and chatter snippets
- Wizard (TransientModel) snippet
Known Issues
No known issues at this time. Please open an issue if you find one.
License
MIT License — Copyright (c) 2025 Aman Kumar Singh
Free to use, modify, and distribute.
Made with ❤️ by Aman Kumar Singh for the Odoo Developer Community