Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mstuttgart/odoo-snippets

Develop Odoo modules faster and with no Typing Errors.
https://github.com/mstuttgart/odoo-snippets

extension hacktoberfest neovim-plugin nvim odoo python snippets tools vscode webdevelopment xml

Last synced: 3 months ago
JSON representation

Develop Odoo modules faster and with no Typing Errors.

Awesome Lists containing this project

README

        








Odoo Snippets


Develop Odoo modules faster and with no Typing Errors



Version


Visual Studio Marketplace Installs


Visual Studio Marketplace Downloads


Visual Studio Marketplace Rating


Works on




Neovim


VsCode


About |
Installation |
Usage |
Contributing |
Release Notes |
Credits

## About

This extension works on [VsCode](https://code.visualstudio.com) and [Neovim](https://neovim.io/). This add code snippets for [Odoo](https://www.odoo.com) to help you to develop Odoo modules faster and with no Typing Errors on .

All snippets follow the [OCA Maintainer Guidelines](https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md) and are made to Odoo version `12.0`+.

## Installation

### VsCode

Launch *Quick Open*
- Linux `Ctrl+P`
- macOS `⌘P`
- Windows `Ctrl+P`

Paste the following command and press `Enter`:

```
ext install mstuttgart.odoo-snippets
```

### Neovim

This collection of snippets should work with any snippet engine that supports loading vscode snippets. Like for example:

- [vim-vsnip](https://github.com/hrsh7th/vim-vsnip)
- [LuaSnip](https://github.com/L3MON4D3/LuaSnip)
- [coc-snippets](https://github.com/neoclide/coc-snippets)

Use your plugin manager of choice, e.g.

#### With Lazy.nvim

```lua
{
"mstuttgart/vscode-odoo-snippets",
event = "InsertEnter",
}
```

> [!WARNING]
> If you're using LuaSnip make sure to use `require("luasnip.loaders.from_vscode").lazy_load()`, and add
> `mstuttgart/vscode-odoo-snippets` as a dependency for LuaSnip, otherwise snippets might not
> be detected. If you don't use `lazy_load()` you might notice a slower startup-time
>
```lua
{
"L3MON4D3/LuaSnip",
dependencies = { "mstuttgart/vscode-odoo-snippets" },
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
}
```

#### With Packer

```lua
use "rafamadriz/friendly-snippets"
```

## Usage

This extension provide support to following languages (file extensions):

* Python (.py)
* XML (.xml)
* CSV (.csv)

Use `tab` to navegate in snippet positions.

Below is a list of all available snippets.

Python snippets

| Python Snippet | Description |
| -------------- | -------------------------- |
| `ipdb` | Import Python ipdb command |

| Odoo Snippet | Description |
| ------------ | -------------------------------------- |
| `oman` | Create Odoo Manifest |
| `omod` | Create New Odoo Model |
| `omodi` | Inherit Existing Odoo Model |
| `owiz` | Create New Odoo wizard |
| `owizi` | Inherit Existing Odoo wizard |
| `omodt` | Create Test to Odoo Model |
| `ofbin` | Add new field Binary |
| `ofbool` | Add new field Boolean |
| `ofchar` | Add new field Char |
| `ofdate` | Add new field Date |
| `oftime` | Add new field DateTime |
| `offloat` | Add new field Float |
| `ofhtml` | Add new field HTML |
| `ofint` | Add new field Integer |
| `oftxt` | Add new field Text |
| `ofsel` | Add new field Selection |
| `ofm2o` | Add new field Many2one |
| `ofm2m` | Add new field Many2many |
| `ofo2m` | Add new field One2many |
| `omcreate` | Add a method create |
| `omwrite` | Add a method write |
| `omunlink` | Add a method unlink |
| `omcomp` | Add a method compute |
| `omchange` | Add a method onchange |
| `ousercomp` | Add self.user.company_id snippets |
| `oimp` | Add Odoo import snippets |
| `oimpt` | Add Import to Odoo Tests snippets |
| `oimper` | Add Import to Odoo Exceptions snippets |

XML snippets

| XML Snippet | Description |
| ------------ | ---------------------------------------- |
| `odoo` | Create Odoo Tag |
| `oform` | Create Form View |
| `oformi` | Inherit Existing Form View |
| `otree` | Create Tree View |
| `otreei` | Inherit Existing Tree View |
| `osearch` | Create Search View |
| `osearchi` | Inherit Existing Search View |
| `ograph` | Create Graph View |
| `ographi` | Inherit Existing Graph View |
| `opivot` | Create Pivot View |
| `opivoti` | Inherit Existing Pivot View |
| `okanban` | Create Kanban View |
| `okanbani` | Inherit Existing Kanban View |
| `ocalendar` | Create Calendar View |
| `ocalendari` | Inherit Existing Calendar View |
| `ogantt` | Create Gantt View |
| `ogantti` | Inherit Existing Gantt View |
| `oxpath` | Add the structure of xpath |
| `oxpathattr` | Add the structure of xpath to attributes |
| `oact` | Create new Action |
| `onote` | Add notebook and page tags |
| `opage` | Add new page tag |
| `omenur` | Create New Menu Item in the Upper bar |
| `omenuc` | Create New Menu Item for Categories |
| `omenua` | Create New Menu Item for Actions |
| `ocron` | Add a ir.cron record |
| `obtn` | Add Odoo button |
| `obtnbox` | Add Button Box on View |
| `ogroup` | Add group tag on View |
| `ofield` | Add Field on View |
| `odata` | Add data tag on View |
| `ochatter` | Add chatter tag on View |
| `oaurl` | Create action.url tag |
| `oaserver` | Create action.server tag |
| `oaclient` | Create action.client tag |

| Qweb Snippet | Description |
| ------------ | ---------------------------------------------- |
| `oreport` | Create report record on View |
| `otemplate` | Create template tag |
| `otemplatei` | Create template inherit tag |
| `otcall ` | Add t-call tag on View |
| `otforeach` | Add t-foreach tag on View |
| `otif` | Add t-if tag on View |
| `otelif` | Add t-elif tag on View |
| `otifelse` | Add t-if-else tag on View |
| `otraw` | Add t-raw tag on View |
| `otesc` | Add t-esc tag on View |
| `otset` | Add t-set tag on View |
| `otfield` | Add t-field tag on View |
| `otimg` | Add img tag with `t-att-src` attribute on View |

CSV snippets

| CSVSnippet | Description |
| ------------------- | ------------------------------- |
| `ocolumns` | Create columns to access groups |
| `odoo_access_entry` | Create entry to access groups |

## Contributing

Please, see contributing guidelines [here](CONTRIBUTING.md).

## Release Notes

See [changelog](CHANGELOG.md).

## Credits

This snippets are based in [odoo-pycharm-templates](https://github.com/mohamedmagdy/odoo-pycharm-templates) project.

Copyright (C) 2018-2024 by Michell Stuttgart