Skip to content

Commit 5789c4c

Browse files
authored
Merge pull request #7 from mstuttgart/new-snippets
Add new snippets and improve project
2 parents f6dc695 + ee88255 commit 5789c4c

File tree

11 files changed

+343
-108
lines changed

11 files changed

+343
-108
lines changed

.github/workflows/publish.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
on:
2+
push:
3+
tags:
4+
- "*"
5+
6+
name: Deploy Extension
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v1
13+
with:
14+
node-version: 12
15+
16+
- run: npm ci
17+
18+
- name: Publish to Visual Studio Marketplace
19+
uses: HaaLeo/publish-vscode-extension@v0
20+
with:
21+
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
22+
registryUrl: https://marketplace.visualstudio.com

.github/workflows/validate.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Valindate JSON
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
build-and-test:
8+
9+
runs-on: ubuntu-latest
10+
name: Build and test
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: bahmutov/npm-install@v1
15+
16+
- name: Install JSON lint
17+
run: npm install jsonlint -g
18+
19+
- name: Lint python snippets
20+
run: jsonlint ./snippets/python.json
21+
22+
- name: Lint XML snippets
23+
run: jsonlint ./snippets/xml.json

.travis.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change Log
22

3+
## 2.0.0
4+
5+
- [NEW] Add odoo snippet
6+
- [NEW] Add group snippet
7+
- [NEW] Add TransientModel snippet
8+
- [IMP] Simplify 'data' tag snippet
9+
- [NEW] Add report template tags (t-if, t-call, t-foreach, t-field e etc)
10+
- [NEW] Add github action support
11+
- [DEL] Remove travisci support
12+
- [IMP] Update contributing instructions and README info
13+
- [NEW] Add new logo
14+
315
## 1.0.1
416

517
- [IMP] Improve README

CONTRIBUTING.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,6 @@ and specifies the language of the snippets.
1414
* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
1515
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
1616

17-
## Commit format
18-
19-
Use commits in follow format
20-
21-
> [TAG] My commit message
22-
23-
This `TAG` can be:
24-
25-
* IMP: to improvements
26-
* NEW: to new resource and snippets
27-
* FIX: to bug fixes
28-
* DEL: to remove anything
29-
3017
## Send a PR
3118
* Commit your changes and send us a Pull Request.
3219

README.md

Lines changed: 87 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212

1313
<p align="center">
1414
<a href="https://marketplace.visualstudio.com/items?itemName=mstuttgart.odoo-snippets">
15-
<img src="https://vsmarketplacebadge.apphb.com/version-short/mstuttgart.odoo-snippets.svg?style=flat-square&color=875A7B" alt="Version">
15+
<img src="https://vsmarketplacebadge.apphb.com/version-short/mstuttgart.odoo-snippets.svg?style=flat-square&color=875A7B" alt="Version">
1616
</a>
1717
<a href="https://marketplace.visualstudio.com/items?itemName=mstuttgart.odoo-snippets">
18-
<img src="https://vsmarketplacebadge.apphb.com/installs/mstuttgart.odoo-snippets.svg?style=flat-square&color=875A7B" alt="Installs">
18+
<img alt="Visual Studio Marketplace Installs" src="https://img.shields.io/visual-studio-marketplace/i/mstuttgart.odoo-snippets?color=875A7B&style=flat-square">
19+
</a>
20+
<a href="https://marketplace.visualstudio.com/items?itemName=mstuttgart.odoo-snippets">
21+
<img alt="Visual Studio Marketplace Downloads" src="https://img.shields.io/visual-studio-marketplace/d/mstuttgart.odoo-snippets?color=875A7B&style=flat-square">
1922
</a>
2023
<a href="https://marketplace.visualstudio.com/items?itemName=mstuttgart.odoo-snippets">
2124
<img src="https://vsmarketplacebadge.apphb.com/rating/mstuttgart.odoo-snippets.svg?style=flat-square&color=875A7B" alt="Ratings">
@@ -61,67 +64,87 @@ This extension provide support to following languages (file extensions):
6164

6265
Below is a list of all available snippets.
6366

64-
### Python Snippets
65-
66-
| Snippet | Description |
67-
| ---------- | --------------------------- |
68-
| `oman` | Create Odoo Manifest |
69-
| `omod` | Create New Odoo Model |
70-
| `omodi` | Inherit Existing Odoo Model |
71-
| `omodt` | Create Test to Odoo Model |
72-
| `ofbin` | Add new field Binary |
73-
| `ofbool` | Add new field Boolean |
74-
| `ofchar` | Add new field Char |
75-
| `ofdate` | Add new field Date |
76-
| `oftime` | Add new field DateTime |
77-
| `offloat` | Add new field Float |
78-
| `ofhtml` | Add new field HTML |
79-
| `ofint` | Add new field Integer |
80-
| `oftxt` | Add new field Text |
81-
| `ofsel` | Add new field Selection |
82-
| `ofm2o` | Add new field Many2one |
83-
| `ofm2m` | Add new field Many2many |
84-
| `ofo2m` | Add new field One2many |
85-
| `omcreate` | Add a method create |
86-
| `omwrite` | Add a method write |
87-
| `omunlink` | Add a method unlink |
88-
| `omcomp` | Add a method compute |
89-
| `omchange` | Add a method onchange |
90-
91-
### XML Snippets
92-
93-
| Snippet | Description |
94-
| ------------ | ---------------------------------------- |
95-
| `oform` | Create Form View |
96-
| `oformi` | Inherit Existing Form View |
97-
| `otree` | Create Tree View |
98-
| `otreei` | Inherit Existing Tree View |
99-
| `osearch` | Create Search View |
100-
| `osearchi` | Inherit Existing Search View |
101-
| `ograph` | Create Graph View |
102-
| `ographi` | Inherit Existing Graph View |
103-
| `opivot` | Create Pivot View |
104-
| `opivoti` | Inherit Existing Pivot View |
105-
| `okanban` | Create Kanban View |
106-
| `okanbani` | Inherit Existing Kanban View |
107-
| `ocalendar` | Create Calendar View |
108-
| `ocalendari` | Inherit Existing Calendar View |
109-
| `ogantt` | Create Gantt View |
110-
| `ogantti` | Inherit Existing Gantt View |
111-
| `oxpath` | Add the structure of xpath |
112-
| `oxpathattr` | Add the structure of xpath to attributes |
113-
| `oact` | Create new Action |
114-
| `onote` | Add notebook and page tags |
115-
| `opage` | Add new page tag |
116-
| `omenur` | Create New Menu Item in the Upper bar |
117-
| `omenuc` | Create New Menu Item for Categories |
118-
| `omenua` | Create New Menu Item for Actions |
119-
| `ocron` | Add a ir.cron record (11.0 version) |
120-
| `obtn` | Add Odoo button |
121-
| `obtnbox` | Add Button Box on View |
122-
| `ofield` | Add Field on View |
123-
| `odata` | Add data tag on View |
124-
| `ostatusbar` | Create Header with Status Bar |
67+
<details>
68+
<summary>Python snippets</summary>
69+
70+
| Snippet | Description |
71+
| ---------- | ---------------------------- |
72+
| `oman` | Create Odoo Manifest |
73+
| `omod` | Create New Odoo Model |
74+
| `omodi` | Inherit Existing Odoo Model |
75+
| `owiz` | Create New Odoo wizard |
76+
| `owizi` | Inherit Existing Odoo wizard |
77+
| `omodt` | Create Test to Odoo Model |
78+
| `ofbin` | Add new field Binary |
79+
| `ofbool` | Add new field Boolean |
80+
| `ofchar` | Add new field Char |
81+
| `ofdate` | Add new field Date |
82+
| `oftime` | Add new field DateTime |
83+
| `offloat` | Add new field Float |
84+
| `ofhtml` | Add new field HTML |
85+
| `ofint` | Add new field Integer |
86+
| `oftxt` | Add new field Text |
87+
| `ofsel` | Add new field Selection |
88+
| `ofm2o` | Add new field Many2one |
89+
| `ofm2m` | Add new field Many2many |
90+
| `ofo2m` | Add new field One2many |
91+
| `omcreate` | Add a method create |
92+
| `omwrite` | Add a method write |
93+
| `omunlink` | Add a method unlink |
94+
| `omcomp` | Add a method compute |
95+
| `omchange` | Add a method onchange |
96+
97+
</details>
98+
99+
<details>
100+
<summary>XML and Report snippets</summary>
101+
102+
| Snippet | Description |
103+
| ------------ | ---------------------------------------------- |
104+
| `odoo` | Create Odoo Tag |
105+
| `oform` | Create Form View |
106+
| `oformi` | Inherit Existing Form View |
107+
| `otree` | Create Tree View |
108+
| `otreei` | Inherit Existing Tree View |
109+
| `osearch` | Create Search View |
110+
| `osearchi` | Inherit Existing Search View |
111+
| `ograph` | Create Graph View |
112+
| `ographi` | Inherit Existing Graph View |
113+
| `opivot` | Create Pivot View |
114+
| `opivoti` | Inherit Existing Pivot View |
115+
| `okanban` | Create Kanban View |
116+
| `okanbani` | Inherit Existing Kanban View |
117+
| `ocalendar` | Create Calendar View |
118+
| `ocalendari` | Inherit Existing Calendar View |
119+
| `ogantt` | Create Gantt View |
120+
| `ogantti` | Inherit Existing Gantt View |
121+
| `oxpath` | Add the structure of xpath |
122+
| `oxpathattr` | Add the structure of xpath to attributes |
123+
| `oact` | Create new Action |
124+
| `onote` | Add notebook and page tags |
125+
| `opage` | Add new page tag |
126+
| `omenur` | Create New Menu Item in the Upper bar |
127+
| `omenuc` | Create New Menu Item for Categories |
128+
| `omenua` | Create New Menu Item for Actions |
129+
| `ocron` | Add a ir.cron record (11.0 version) |
130+
| `obtn` | Add Odoo button |
131+
| `obtnbox` | Add Button Box on View |
132+
| `ogroup` | Add group tag on View |
133+
| `ofield` | Add Field on View |
134+
| `odata` | Add data tag on View |
135+
| `oreport` | Create report record on View |
136+
| `otemplate` | Create template tag |
137+
| `otemplatei` | Create template inherit tag |
138+
| `otcall ` | Add t-call tag on View |
139+
| `otforeach` | Add t-foreach tag on View |
140+
| `otif` | Add t-if tag on View |
141+
| `otraw` | Add t-raw tag on View |
142+
| `otesc` | Add t-esc tag on View |
143+
| `otset` | Add t-set tag on View |
144+
| `otfield` | Add t-field tag on View |
145+
| `otimg` | Add img tag with `t-att-src` attribute on View |
146+
147+
</details>
125148

126149
## Contributing
127150

@@ -135,4 +158,4 @@ See [changelog](CHANGELOG.md).
135158

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

138-
Copyright (C) 2018-2020 by Michell Stuttgart
161+
Copyright (C) 2018-2021 by Michell Stuttgart

images/icon.png

5.86 KB
Loading

package-lock.json

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "odoo-snippets",
33
"displayName": "Odoo Code Snippets",
44
"description": "This snippets can help you to develop Odoo modules faster and with no Typing Errors.",
5-
"version": "1.0.1",
5+
"version": "2.0.0",
66
"license": "SEE LICENSE IN LICENSE",
77
"publisher": "mstuttgart",
88
"author": {
@@ -34,7 +34,8 @@
3434
"url": "https://github.com/mstuttgart/vscode-odoo-snippets"
3535
},
3636
"contributes": {
37-
"snippets": [{
37+
"snippets": [
38+
{
3839
"language": "python",
3940
"path": "./snippets/python.json"
4041
},

snippets/python.json

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,35 @@
4848
"odoo_inherit_model": {
4949
"prefix": "omodi",
5050
"body": [
51-
"from odoo import api, fields, models",
51+
"from odoo import models",
5252
"\n\nclass ${1:ModuleName}(models.Model):",
5353
"\t_inherit = '${2:module.name}'",
54-
"\n\tname = fields.Char(string='Name')",
5554
"$0"
5655
],
5756
"description": "Inherit Existing Odoo Model"
5857
},
58+
"odoo_new_wizard": {
59+
"prefix": "owiz",
60+
"body": [
61+
"from odoo import fields, models",
62+
"\n\nclass ${1:ModuleName}(models.TransientModel):",
63+
"\t_name = '${2:module.name}'",
64+
"\t_description = '${3:New Description}'",
65+
"\n\tname = fields.Char(string='Name')",
66+
"$0"
67+
],
68+
"description": "Create New Odoo Wizard"
69+
},
70+
"odoo_inherit_wizard": {
71+
"prefix": "owizi",
72+
"body": [
73+
"from odoo import models",
74+
"\n\nclass ${1:ModuleName}(models.TransientModel):",
75+
"\t_inherit = '${2:module.name}'",
76+
"$0"
77+
],
78+
"description": "Inherit Existing Odoo Wizard"
79+
},
5980
"odoo_test_model": {
6081
"prefix": "omodt",
6182
"body": [

0 commit comments

Comments
 (0)