├── README.md ├── azure-pipelines.yml ├── images └── odoo_logo.png ├── package.json ├── releases ├── odoo-snippets-0.6.1.vsix └── odoo-snippets-0.7.1.vsix ├── snippets ├── python.json └── xml.json └── source ├── convert.py ├── data.json ├── demo.gif ├── glist.py └── snippets.json /README.md: -------------------------------------------------------------------------------- 1 | # odoo-snippets README 2 | 3 | 4 | 5 | ![demo](source/demo.gif) 6 | 7 | 8 | 9 | * 包含 537 个代码片段 10 | 11 | * 支持Camel Case 和 Snake Case 之间的 自动转换 12 | 13 | 14 | 例如 15 | 16 | 1. 模型名 ModelName > model.name 17 | 2. 字段名 field_name > Field Name 18 | 3. 记录名 view_model_name_viewtype > model.name.type.view 19 | 20 | 21 | 22 | **Enjoy!** 23 | 24 | 25 | ## The Snippets list; 26 | 27 | 1. python snippets ([Python](#python)) 28 | 29 | 1. xml snippets ([XML](#xml)) 30 | 31 | 1. 32 | 33 | ### Python 34 | | prefix | description | 35 | ---------|--------------| 36 | | oo_TransactionCase | | 37 | | oo_addTypeEqualityFunc | addTypeEqualityFunc | 38 | | oo_api/depends | decorator depends | 39 | | oo_assertAlmostEqual | assertAlmostEqual | 40 | | oo_assertDictContainsSubset | assertDictContainsSubset | 41 | | oo_assertDictEqual | assertDictEqual | 42 | | oo_assertEqual | assertEqual | 43 | | oo_assertFalse | assertFalse | 44 | | oo_assertGreater | assertGreater | 45 | | oo_assertGreaterEqual | assertGreaterEqual | 46 | | oo_assertIn | assertIn | 47 | | oo_assertIs | assertIs | 48 | | oo_assertIsInstance | assertIsInstance | 49 | | oo_assertIsNone | assertIsNone | 50 | | oo_assertIsNot | assertIsNot | 51 | | oo_assertIsNotNone | assertIsNotNone | 52 | | oo_assertItemsEqual | assertItemsEqual | 53 | | oo_assertLess | assertLess | 54 | | oo_assertLessEqual | assertLessEqual | 55 | | oo_assertListEqual | assertListEqual | 56 | | oo_assertMultiLineEqual | assertMultiLineEqual | 57 | | oo_assertNotAlmostEqual | assertNotAlmostEqual | 58 | | oo_assertNotEqual | assertNotEqual | 59 | | oo_assertNotIn | assertNotIn | 60 | | oo_assertNotIsInstance | assertNotIsInstance | 61 | | oo_assertNotRegexpMatches | assertNotRegexpMatches | 62 | | oo_assertRaises | assertRaises (extended) | 63 | | oo_assertRaises | assertRaises | 64 | | oo_assertRaisesRegexp | assertRaisesRegexp (extended) | 65 | | oo_assertRaisesRegexp | assertRaisesRegexp | 66 | | oo_assertRegexpMatches | assertRegexpMatches | 67 | | oo_assertSequenceEqual | assertSequenceEqual | 68 | | oo_assertSetEqual | assertSetEqual | 69 | | oo_assertTrue | assertTrue | 70 | | oo_assertTupleEqual | assertTupleEqual | 71 | | oo_attr/_auto | Adds the _auto attribute | 72 | | oo_attr/_inherit | Model attribute _inherit with a module list | 73 | | oo_attr/_inherits | Model attribute _inherits and single parent field | 74 | | oo_auto_join | Field attribute: auto_join | 75 | | oo_comodel_name | Field attribute: comodel_name | 76 | | oo_company_dependent | Field attribute: company_dependent | 77 | | oo_compute | Field attribute: compute | 78 | | oo_compute_sudo | Field attribute: compute_sudo | 79 | | oo_constraints | Model SQL contraints | 80 | | oo_constraints | Model Python contraints | 81 | | oo_context | Field attribute: context | 82 | | oo_controller/controller | Odoo web controller class | 83 | | oo_controller/route | Odoo web controller route | 84 | | oo_copy | Field attribute: copy | 85 | | oo_copyright | Copyright statement Full | 86 | | oo_copyright | Copyright statement Simple | 87 | | oo_copyright | Copyright statement Full | 88 | | oo_def/log | Common logging log method | 89 | | oo_default | Field attribute: search, lambda function | 90 | | oo_default company | Field attribute: default company | 91 | | oo_default user | Field attribute: default user | 92 | | oo_default_model | Field attribute: default_model | 93 | | oo_digits | Field attribute: digits | 94 | | oo_digits/get_precision | Field attribute: digits | 95 | | oo_domain | Field attribute: domain | 96 | | oo_domain | Field attribute: domain lambda | 97 | | oo_fail | fail | 98 | | oo_feature/company_plant | Adds the company/plant support | 99 | | oo_feature/mail_thread | Adds Mail Thread support | 100 | | oo_feature/multi_company | Adds the multi company support | 101 | | oo_feature/needaction | Adds NeedAction support | 102 | | oo_feature/parent_child | Adds the _parent_store attribute and parent_left and parent_right | 103 | | oo_feature/status | Adds state support | 104 | | oo_feature/utm | Adds utm support | 105 | | oo_field.company_id | | 106 | | oo_fields.Attachment | | 107 | | oo_fields.Binary | | 108 | | oo_fields.Boolean | | 109 | | oo_fields.Char | | 110 | | oo_fields.Date | | 111 | | oo_fields.Datetime | | 112 | | oo_fields.Float | | 113 | | oo_fields.Html | | 114 | | oo_fields.Integer | | 115 | | oo_fields.Many2many | | 116 | | oo_fields.Many2one | | 117 | | oo_fields.One2many | | 118 | | oo_fields.Reference | | 119 | | oo_fields.Selection | | 120 | | oo_fields.Text | | 121 | | oo_file/`__init__` | `__init__` file | 122 | | oo_file/`__manifest__` | Odoo manifest file common structure | 123 | | oo_file/`__manifest__` | Odoo manifest file common structure | 124 | | oo_file/`__openerp__` | Odoo manifest file common structure | 125 | | oo_file/coding | utf-8 coding | 126 | | oo_file/controller | Odoo web controller file | 127 | | oo_file/model | Odoo model file | 128 | | oo_help | Field attribute: help | 129 | | oo_import/datetime | import date and time tools | 130 | | oo_import/dp | | 131 | | oo_import/exceptions | | 132 | | oo_import/logging | logging instance | 133 | | oo_import/translate | import odoo translate | 134 | | oo_index | Field attribute: index | 135 | | oo_inverse | Field attribute: inverse, lambda function | 136 | | oo_limit | Field attribute: limit | 137 | | oo_method/_browse | _browse method signature | 138 | | oo_method/_onchange | _onchange method signature, code | 139 | | oo_method/_onchange | _onchange method signature, domain | 140 | | oo_method/_onchange | _onchange method signature, warning | 141 | | oo_method/_search | _search method signature | 142 | | oo_method/action_confirm | action_confirm method signature | 143 | | oo_method/compute | _compute method signature | 144 | | oo_method/copy | copy method signature | 145 | | oo_method/create | create method signature | 146 | | oo_method/default_get | default_get method signature | 147 | | oo_method/fields_get | fields_get remove fields from search and groubby | 148 | | oo_method/get_empty_list_help | get_empty_list_help method signature | 149 | | oo_method/get_formview_id | get_formview_id method signature | 150 | | oo_method/init | init method signature | 151 | | oo_method/name_get | name_get method signature | 152 | | oo_method/name_search | name_search method signature | 153 | | oo_method/toggle_active | toggle_active method signature | 154 | | oo_method/unlink | unlink method signature | 155 | | oo_method/unlink_restrict | restrict unlink | 156 | | oo_method/view_header_get | view_header_get method signature | 157 | | oo_method/view_init | view_init method signature | 158 | | oo_method/write | write method signature | 159 | | oo_model/abstract | Odoo abstract model class | 160 | | oo_model/inherit | Odoo inherit model class | 161 | | oo_model/model | Odoo generic model class | 162 | | oo_model/transient | Odoo transient model class | 163 | | oo_ondelete | Field attribute: ondelete | 164 | | oo_oodict/stock_move/~12 | | 165 | | oo_readonly | Field attribute: readonly | 166 | | oo_readonly/states | Field attribute: readonly states | 167 | | oo_related | Field attribute: related | 168 | | oo_related_sudo | Field attribute: related_sudo | 169 | | oo_required | Field attribute: required | 170 | | oo_return/act_window | pop window | 171 | | oo_return/act_window_close | close window | 172 | | oo_selection_add | Field attribute: selection_add | 173 | | oo_selection_element | Field attribute: selection add new element | 174 | | oo_sequence/line_number | Line Number Add 10 automaticlly | 175 | | oo_sequence/next_by_code | next_by_code, used in create() | 176 | | oo_size | Field attribute: size | 177 | | oo_states | Field attribute: states | 178 | | oo_states/invisible | Field attribute: states state invisible | 179 | | oo_states/readonly | Field attribute: states state readonly | 180 | | oo_states/required | Field attribute: states state required | 181 | | oo_states/state | Field attribute: states state | 182 | | oo_store | Field attribute: store | 183 | | oo_string | Field attribute: string | 184 | | oo_super | Call Python parent class | 185 | | oo_test | Test case method | 186 | | oo_track_visibility | Field attribute: track_visibility | 187 | | oo_translate | Field attribute: translate | 188 | | oo_x2m/create | x2m create | 189 | | oo_x2m/delete | x2m delete, don't use in create() | 190 | | oo_x2m/link | x2m link, don't use in One2many | 191 | | oo_x2m/replace | x2m replace, don't use in create() and One2many | 192 | | oo_x2m/unlink | x2m unlink, don't use in create() | 193 | | oo_x2m/unlink_all | x2m unlink all, don't use in create() | 194 | | oo_x2m/update | x2m update, don't use in create() | 195 | 196 | 197 | ### XML 198 | | prefix | description | 199 | ---------|--------------| 200 | | oo_action/binding | Fully formated time relative to now | 201 | | oo_arch/form | Common form tag to be added inside a ir.ui.view | 202 | | oo_arch/graph | Common graph tag to be added inside a ir.ui.view | 203 | | oo_arch/pivot | Common graph tag to be added inside a ir.ui.view | 204 | | oo_arch/search | Common search tag to be added inside a ir.ui.view | 205 | | oo_arch/tree | Common tree tag to be added inside a ir.ui.view | 206 | | oo_attribute | | 207 | | oo_attribute/domain | | 208 | | oo_attribute/domain | | 209 | | oo_attribute/invisible | | 210 | | oo_attribute/invisible | | 211 | | oo_attribute/options | | 212 | | oo_attribute/options | | 213 | | oo_attribute/readonly | | 214 | | oo_attribute/readonly | | 215 | | oo_attribute/required | | 216 | | oo_attribute/required | | 217 | | oo_attribute | | 218 | | oo_attrs | field attr attrs | 219 | | oo_attrs/invisible | field attr attrs column_invisible | 220 | | oo_attrs/invisible | field attr attrs invisible | 221 | | oo_attrs/readonly | field attr attrs readonly | 222 | | oo_attrs/required | field attr attrs required | 223 | | oo_button/cancel | Cancel button tag definition | 224 | | oo_button/full | Common button tag definition | 225 | | oo_button/inline | Inline button tag definition | 226 | | oo_chatter | Common XML to add a tracking area inside a form view | 227 | | oo_class/oe_edit_only | field attr class oe_edit_only | 228 | | oo_class/oe_inline | field attr class oe_inline | 229 | | oo_class/oe_left | field attr class oe_left | 230 | | oo_class/oe_no_avatar | field attr class oe_no_avatar | 231 | | oo_class/oe_no_button | field attr class oe_no_button | 232 | | oo_class/oe_read_only | field attr class oe_read_only | 233 | | oo_class/oe_right | field attr class oe_right | 234 | | oo_context | tag attr context | 235 | | oo_create | tag attr create | 236 | | oo_decoration | field attr decoration | 237 | | oo_default_order | field attr default_order | 238 | | oo_delete | tag attr delete | 239 | | oo_domain | field attr domain | 240 | | oo_duplicate | tag attr duplicate | 241 | | oo_edit | tag attr edit | 242 | | oo_extid/group_no_one | | 243 | | oo_extid/group_system | | 244 | | oo_field/boolean | Common XML tag for field type Boolean | 245 | | oo_field/char | Common XML tag for field type Char | 246 | | oo_field/compound | Compound field | 247 | | oo_field/date | Common XML tag for field type Date | 248 | | oo_field/datetime | Common XML tag for field type Datetime | 249 | | oo_field/float | Common XML tag for field type Float | 250 | | oo_field/full | Full field tag | 251 | | oo_field/html | Common XML tag for field type Html | 252 | | oo_field/inline | Inline field tag | 253 | | oo_field/integer | Common XML tag for field type Integer | 254 | | oo_field/many2many | Common XML tag for field type Many2many | 255 | | oo_field/many2one | Common XML tag for field type Many2one | 256 | | oo_field/one2many | Common XML tag for field type One2many | 257 | | oo_field/selection | Common XML tag for field type Selection | 258 | | oo_field/simple | Simple field tag | 259 | | oo_field/text | Common XML tag for field type Text | 260 | | oo_field_group_ids/display_incoterm | | 261 | | oo_field_group_ids/multi_company | | 262 | | oo_field_group_ids/no_one | | 263 | | oo_field_group_ids/production_lot | | 264 | | oo_field_group_ids/stock_multi_locations | | 265 | | oo_field_group_ids/system | | 266 | | oo_field_group_ids/tracking_lot | | 267 | | oo_field_group_ids/tracking_owner | | 268 | | oo_field_group_ids/uom | | 269 | | oo_field_groups_id | | 270 | | oo_file/xml | Common base XML structure to be used in Odoo module data files | 271 | | oo_filter/archive | Filter archived | 272 | | oo_filter/latest_by_day | Filter list latest order by days | 273 | | oo_filter_domain | field attr filter_domain | 274 | | oo_function | | 275 | | oo_group_display_incoterm | | 276 | | oo_group_multi_company | | 277 | | oo_group_no_one | | 278 | | oo_group_production_lot | | 279 | | oo_group_stock_multi_locations | | 280 | | oo_group_system | | 281 | | oo_group_tracking_lot | | 282 | | oo_group_tracking_owner | | 283 | | oo_group_uom | | 284 | | oo_groups | | 285 | | oo_groups | field attr groups | 286 | | oo_invisible | field attr invisible | 287 | | oo_layout/button_box | layout button_box definition | 288 | | oo_layout/group | | 289 | | oo_layout/label | Field Label | 290 | | oo_layout/separator | Common separator tag to be added inside a ir.ui.view | 291 | | oo_link | Link tag to inglude an stylesheet | 292 | | oo_notebook | | 293 | | oo_notebook/page | | 294 | | oo_options/always_reload | field attr options always_reload | 295 | | oo_options/no_create | field attr options no_create | 296 | | oo_options/no_create_edit | field attr options no_create_edit | 297 | | oo_options/no_open | field attr options no_open | 298 | | oo_options/no_quick_create | field attr options no_create/no_open/no_create_edit | 299 | | oo_options/reload_whole_on_button | field attr options reload_whole_on_button | 300 | | oo_position/after | xpath position/after | 301 | | oo_position/attributes | xpath position/attributes | 302 | | oo_position/before | xpath position/before | 303 | | oo_position/inside | xpath position/inside | 304 | | oo_qweb_t-att | Qweb named attribute | 305 | | oo_qweb_t-att | Qweb attribute | 306 | | oo_qweb_t-attf | Qweb format string attribute | 307 | | oo_qweb_t-call | Qweb inline call template | 308 | | oo_qweb_t-call | Qweb call template | 309 | | oo_qweb_t-esc | Qweb data output | 310 | | oo_qweb_t-extend | Qweb template inheritance | 311 | | oo_qweb_t-field | Qweb field access | 312 | | oo_qweb_t-foreach | Qweb loop | 313 | | oo_qweb_t-if | Qweb inline conditional | 314 | | oo_qweb_t-if | Qweb conditional | 315 | | oo_qweb_t-js | Qweb javascript | 316 | | oo_qweb_t-log | Qweb logging | 317 | | oo_qweb_t-name | Qweb top level named template | 318 | | oo_qweb_t-raw | Qweb template from context | 319 | | oo_qweb_t-set | Qweb inline variable | 320 | | oo_qweb_t-set | Qweb variable | 321 | | oo_readonly | field attr readonly | 322 | | oo_record | | 323 | | oo_record/assets | Include module assets in backend views | 324 | | oo_record/base.action.rule | Common record definition for base.action.rule | 325 | | oo_record/email.template | Common record definition for email.template | 326 | | oo_record/filter | Common ir.filters record definition | 327 | | oo_record/ir.actions.act_window | Common record definition for ir.actions.act_window | 328 | | oo_record/ir.actions.act_window.view | Common record definition for ir.actions.act_window.view | 329 | | oo_record/ir.actions.report.xml | Common record definition for ir.actions.report.xml | 330 | | oo_record/ir.actions.server | Common record definition for ir.actions.server, invoking a client action | 331 | | oo_record/ir.actions.server | Common record definition for ir.actions.server, running Python code | 332 | | oo_record/ir.actions.server | Common record definition for ir.actions.server, executing multiple actions | 333 | | oo_record/ir.actions.server | Common record definition for ir.actions.server, creating objects | 334 | | oo_record/ir.actions.server | Common record definition for ir.actions.server, updating objects | 335 | | oo_record/ir.actions.server | Common record definition for ir.actions.server, triggering | 336 | | oo_record/ir.actions.todo | | 337 | | oo_record/ir.config_parameter | Common ir.config_parameter record definition | 338 | | oo_record/ir.model | Common record definition for ir.model | 339 | | oo_record/ir.model.access | XML ir.model.access record | 340 | | oo_record/ir.model.data | Common record definition for ir.model.data | 341 | | oo_record/ir.module.category | XML ir.model.category record | 342 | | oo_record/ir.rule | XML ir.rule record | 343 | | oo_record/ir.values | Common record definition for ir.values | 344 | | oo_record/menu | Common ir.ui.menu record definition | 345 | | oo_record/product.product | XML product.product record | 346 | | oo_record/product.template | XML product.template record | 347 | | oo_record/res.groups | XML res.groups record | 348 | | oo_record/view | Common ir.ui.view record definition | 349 | | oo_ref | field attr ref | 350 | | oo_report.paperformat | Common record definition for report.paperformat | 351 | | oo_report_fullreport | Report: document and translation; action.report.xml and ir.values | 352 | | oo_report_layout | Report external_layout | 353 | | oo_report_layout | Report external_layout_footer | 354 | | oo_report_layout | Report external_layout_header | 355 | | oo_report_layout | Report html_container | 356 | | oo_report_layout | Report internal_layout | 357 | | oo_report_layout | Report layout | 358 | | oo_report_layout | Report minimal_layout | 359 | | oo_report_layout | Report style | 360 | | oo_report_t | Report qweb container | 361 | | oo_report_t-raw | Qweb translate document | 362 | | oo_required | field attr required | 363 | | oo_script | Script tag to inglude an javascript | 364 | | oo_search/filter | Common filter tag to be added inside a search view | 365 | | oo_search/group_by | | 366 | | oo_smart_button | smart button definition | 367 | | oo_status | Adds state support | 368 | | oo_statusbar | Include module assets in backend views | 369 | | oo_time/relativetime | Fully formated time relative to now | 370 | | oo_time/strftime | Fully formated strftime | 371 | | oo_view/full | Views: tree, form, search; act_window and menu | 372 | | oo_view/inherit | Inherited Views: tree, form, search | 373 | | oo_view/inherit | Inherited Views: tree, form | 374 | | oo_widget/ace | widget ace editor | 375 | | oo_widget/boolean_button | widget boolean_button | 376 | | oo_widget/image | widget image | 377 | | oo_widget/image | widget image | 378 | | oo_widget/many2many | widget many2many | 379 | | oo_widget/many2many_binary | widget many2many_binary | 380 | | oo_widget/many2many_checkboxes | widget many2many_checkboxes | 381 | | oo_widget/many2many_kanban | widget many2many_kanban | 382 | | oo_widget/many2many_tags | widget many2many_tags | 383 | | oo_widget/percentpie | widget percentpie | 384 | | oo_widget/progressbar | widget progressbar | 385 | | oo_widget/radio | widget radio | 386 | | oo_widget/selection | widget selection | 387 | | oo_widget/statinfo | widget statinfo | 388 | | oo_widget/statusbar | widget statusbar | 389 | | oo_widget/toggle_button | widget toggle_button | 390 | | oo_xpath | Common xpath tag to be added inside a ir.ui.view | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # Node.js 2 | # Build a general Node.js project with npm. 3 | # Add steps that analyze code, save build artifacts, deploy, and more: 4 | # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript 5 | 6 | trigger: 7 | - master 8 | 9 | pool: 10 | vmImage: 'ubuntu-latest' 11 | 12 | steps: 13 | - task: NodeTool@0 14 | inputs: 15 | versionSpec: '10.x' 16 | displayName: 'Install Node.js' 17 | 18 | - script: | 19 | git config --global user.email "jeffery9@outlook.com" 20 | git config --global user.name "jeffery CHEN fan" 21 | npm install -g vsce 22 | vsce publish minor -p $(PAT) 23 | displayName: 'publish to vscode market' 24 | -------------------------------------------------------------------------------- /images/odoo_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeffery9/vscode-odoo-snippets/cc05af363823009f2178729cbbdd8ac26db699e0/images/odoo_logo.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "odoo-snippets", 3 | "displayName": "Odoo Snippets", 4 | "description": "Code Snippets for Odoo using new api, support Python, XML.", 5 | "version": "0.7.1", 6 | "publisher": "jeffery9", 7 | "engines": { 8 | "vscode": "^1.0.0" 9 | }, 10 | "categories": [ 11 | "Snippets" 12 | ], 13 | "contributes": { 14 | "snippets": [ 15 | { 16 | "language": "python", 17 | "path": "./snippets/python.json" 18 | }, 19 | { 20 | "language": "xml", 21 | "path": "./snippets/xml.json" 22 | } 23 | ] 24 | }, 25 | "icon": "images/odoo_logo.png", 26 | "repository": "https://github.com/jeffery9/vscode-odoo-snippets" 27 | } 28 | -------------------------------------------------------------------------------- /releases/odoo-snippets-0.6.1.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeffery9/vscode-odoo-snippets/cc05af363823009f2178729cbbdd8ac26db699e0/releases/odoo-snippets-0.6.1.vsix -------------------------------------------------------------------------------- /releases/odoo-snippets-0.7.1.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeffery9/vscode-odoo-snippets/cc05af363823009f2178729cbbdd8ac26db699e0/releases/odoo-snippets-0.7.1.vsix -------------------------------------------------------------------------------- /snippets/python.json: -------------------------------------------------------------------------------- 1 | { 2 | "TransactionCase": { 3 | "body": [ 4 | "", 5 | "from openerp.tests.common import TransactionCase", 6 | "", 7 | "", 8 | "class ${1:ModelName}(TransactionCase):", 9 | " \"\"\" ${2:This class contains the unit tests for '${1/(.+?)([A-Z])/${1:/downcase}.${2:/downcase}/g}'.}", 10 | "", 11 | " Tests:", 12 | " - ${3}: Checks if the ${3} works properly", 13 | " \"\"\"", 14 | "", 15 | " def setUp(self):", 16 | " super(${1}, self).setUp()", 17 | "", 18 | " def test_${3:item_name}(self):", 19 | " \"\"\" Checks if the ${3} works properly \"\"\"", 20 | "", 21 | " ${0:pass}", 22 | "" 23 | ], 24 | "description": "", 25 | "prefix": "oo_TransactionCase" 26 | }, 27 | "addTypeEqualityFunc": { 28 | "body": [ 29 | "", 30 | "addTypeEqualityFunc(${1:typeobj}, ${2:function})", 31 | "" 32 | ], 33 | "description": "addTypeEqualityFunc", 34 | "prefix": "oo_addTypeEqualityFunc" 35 | }, 36 | "api/depends": { 37 | "body": [ 38 | "", 39 | "@api.depends('${1:field}')", 40 | "" 41 | ], 42 | "description": "decorator depends", 43 | "prefix": "oo_api/depends" 44 | }, 45 | "assertAlmostEqual": { 46 | "body": [ 47 | "", 48 | "assertAlmostEqual(${1:first}, ${2:second}${4:, ${3:places=7}}${6:, ${5:msg=None}}${8:, ${7:delta=None}})", 49 | "" 50 | ], 51 | "description": "assertAlmostEqual", 52 | "prefix": "oo_assertAlmostEqual" 53 | }, 54 | "assertDictContainsSubset": { 55 | "body": [ 56 | "", 57 | "assertDictContainsSubset(${1:expected}, ${2:actual}${4:, ${3:msg=None}})", 58 | "" 59 | ], 60 | "description": "assertDictContainsSubset", 61 | "prefix": "oo_assertDictContainsSubset" 62 | }, 63 | "assertDictEqual": { 64 | "body": [ 65 | "", 66 | "assertDictEqual(${1:expected}, ${2:actual}${4:, ${3:msg=None}})", 67 | "" 68 | ], 69 | "description": "assertDictEqual", 70 | "prefix": "oo_assertDictEqual" 71 | }, 72 | "assertEqual": { 73 | "body": [ 74 | "", 75 | "assertEqual(${1:first}, ${2:second}${4:, ${3:msg=None}})", 76 | "" 77 | ], 78 | "description": "assertEqual", 79 | "prefix": "oo_assertEqual" 80 | }, 81 | "assertFalse": { 82 | "body": [ 83 | "", 84 | "assertFalse(${1:expr}${3:, ${2:msg=None}})", 85 | "" 86 | ], 87 | "description": "assertFalse", 88 | "prefix": "oo_assertFalse" 89 | }, 90 | "assertGreater": { 91 | "body": [ 92 | "", 93 | "assertGreater(${1:first}, ${2:second}${4:, ${3:msg=None}})", 94 | "" 95 | ], 96 | "description": "assertGreater", 97 | "prefix": "oo_assertGreater" 98 | }, 99 | "assertGreaterEqual": { 100 | "body": [ 101 | "", 102 | "assertGreaterEqual(${1:first}, ${2:second}${4:, ${3:msg=None}})", 103 | "" 104 | ], 105 | "description": "assertGreaterEqual", 106 | "prefix": "oo_assertGreaterEqual" 107 | }, 108 | "assertIn": { 109 | "body": [ 110 | "", 111 | "assertIn(${1:first}, ${2:second}${4:, ${3:msg=None}})", 112 | "" 113 | ], 114 | "description": "assertIn", 115 | "prefix": "oo_assertIn" 116 | }, 117 | "assertIs": { 118 | "body": [ 119 | "", 120 | "assertIs(${1:first}, ${2:second}${4:, ${3:msg=None}})", 121 | "" 122 | ], 123 | "description": "assertIs", 124 | "prefix": "oo_assertIs" 125 | }, 126 | "assertIsInstance": { 127 | "body": [ 128 | "", 129 | "assertIsInstance(${1:obj}, ${2:cls}${4:, ${3:msg=None}})", 130 | "" 131 | ], 132 | "description": "assertIsInstance", 133 | "prefix": "oo_assertIsInstance" 134 | }, 135 | "assertIsNone": { 136 | "body": [ 137 | "", 138 | "assertIsNone(${1:expr}${3:, ${2:msg=None}})", 139 | "" 140 | ], 141 | "description": "assertIsNone", 142 | "prefix": "oo_assertIsNone" 143 | }, 144 | "assertIsNot": { 145 | "body": [ 146 | "", 147 | "assertIsNot(${1:first}, ${2:second}${4:, ${3:msg=None}})", 148 | "" 149 | ], 150 | "description": "assertIsNot", 151 | "prefix": "oo_assertIsNot" 152 | }, 153 | "assertIsNotNone": { 154 | "body": [ 155 | "", 156 | "assertIsNotNone(${1:expr}${3:, ${2:msg=None}})", 157 | "" 158 | ], 159 | "description": "assertIsNotNone", 160 | "prefix": "oo_assertIsNotNone" 161 | }, 162 | "assertItemsEqual": { 163 | "body": [ 164 | "", 165 | "assertItemsEqual(${1:actual}, ${2:expected}${4:, ${3:msg=None}})", 166 | "" 167 | ], 168 | "description": "assertItemsEqual", 169 | "prefix": "oo_assertItemsEqual" 170 | }, 171 | "assertLess": { 172 | "body": [ 173 | "", 174 | "assertLess(${1:first}, ${2:second}${4:, ${3:msg=None}})", 175 | "" 176 | ], 177 | "description": "assertLess", 178 | "prefix": "oo_assertLess" 179 | }, 180 | "assertLessEqual": { 181 | "body": [ 182 | "", 183 | "assertLessEqual(${1:first}, ${2:second}${4:, ${3:msg=None}})", 184 | "" 185 | ], 186 | "description": "assertLessEqual", 187 | "prefix": "oo_assertLessEqual" 188 | }, 189 | "assertListEqual": { 190 | "body": [ 191 | "", 192 | "assertListEqual(${1:list1}, ${2:list2}${4:, ${3:msg=None}})", 193 | "" 194 | ], 195 | "description": "assertListEqual", 196 | "prefix": "oo_assertListEqual" 197 | }, 198 | "assertMultiLineEqual": { 199 | "body": [ 200 | "", 201 | "assertMultiLineEqual(${1:first}, ${2:second}${4:, ${3:msg=None}})", 202 | "" 203 | ], 204 | "description": "assertMultiLineEqual", 205 | "prefix": "oo_assertMultiLineEqual" 206 | }, 207 | "assertNotAlmostEqual": { 208 | "body": [ 209 | "", 210 | "assertNotAlmostEqual(${1:first}, ${2:second}${4:, ${3:places=7}}${6:, ${5:msg=None}}${9:, ${8:delta=None}})", 211 | "" 212 | ], 213 | "description": "assertNotAlmostEqual", 214 | "prefix": "oo_assertNotAlmostEqual" 215 | }, 216 | "assertNotEqual": { 217 | "body": [ 218 | "", 219 | "assertNotEqual(${1:first}, ${2:second}${4:, ${3:msg=None}})", 220 | "" 221 | ], 222 | "description": "assertNotEqual", 223 | "prefix": "oo_assertNotEqual" 224 | }, 225 | "assertNotIn": { 226 | "body": [ 227 | "", 228 | "assertNotIn(${1:first}, ${2:second}${4:, ${3:msg=None}})", 229 | "" 230 | ], 231 | "description": "assertNotIn", 232 | "prefix": "oo_assertNotIn" 233 | }, 234 | "assertNotIsInstance": { 235 | "body": [ 236 | "", 237 | "assertNotIsInstance(${1:obj}, ${2:cls}${4:, ${3:msg=None}})", 238 | "" 239 | ], 240 | "description": "assertNotIsInstance", 241 | "prefix": "oo_assertNotIsInstance" 242 | }, 243 | "assertNotRegexpMatches": { 244 | "body": [ 245 | "", 246 | "assertNotRegexpMatches(${1:text}, ${2:regexp}${4:, ${3:msg=None}})", 247 | "" 248 | ], 249 | "description": "assertNotRegexpMatches", 250 | "prefix": "oo_assertNotRegexpMatches" 251 | }, 252 | "assertRaises": { 253 | "body": [ 254 | "", 255 | "assertRaises(${1:exception}, ${2:callable}, ${3:*args}, ${4:**kwds})", 256 | "" 257 | ], 258 | "description": "assertRaises (extended)", 259 | "prefix": "oo_assertRaises" 260 | }, 261 | "assertRaises1": { 262 | "body": [ 263 | "", 264 | "assertRaises(${1:exception})", 265 | "" 266 | ], 267 | "description": "assertRaises", 268 | "prefix": "oo_assertRaises" 269 | }, 270 | "assertRaisesRegexp": { 271 | "body": [ 272 | "", 273 | "assertRaisesRegexp(${1:exception}, ${2:regexp}, ${3:callable}, ${4:*args}, ${5:**kwds})", 274 | "" 275 | ], 276 | "description": "assertRaisesRegexp (extended)", 277 | "prefix": "oo_assertRaisesRegexp" 278 | }, 279 | "assertRaisesRegexp1": { 280 | "body": [ 281 | "", 282 | "assertRaisesRegexp(${1:exception}, ${2:regexp})", 283 | "" 284 | ], 285 | "description": "assertRaisesRegexp", 286 | "prefix": "oo_assertRaisesRegexp" 287 | }, 288 | "assertRegexpMatches": { 289 | "body": [ 290 | "", 291 | "assertRegexpMatches(${1:text}, ${2:regexp}${4:, ${3:msg=None}})", 292 | "" 293 | ], 294 | "description": "assertRegexpMatches", 295 | "prefix": "oo_assertRegexpMatches" 296 | }, 297 | "assertSequenceEqual": { 298 | "body": [ 299 | "", 300 | "assertSequenceEqual(${1:seq1}, ${2:seq2}${4:, ${3:msg=None}}${6:, ${5:seq_type=None}})", 301 | "" 302 | ], 303 | "description": "assertSequenceEqual", 304 | "prefix": "oo_assertSequenceEqual" 305 | }, 306 | "assertSetEqual": { 307 | "body": [ 308 | "", 309 | "assertSetEqual(${1:set1}, ${2:set2}${4:, ${3:msg=None}})", 310 | "" 311 | ], 312 | "description": "assertSetEqual", 313 | "prefix": "oo_assertSetEqual" 314 | }, 315 | "assertTrue": { 316 | "body": [ 317 | "", 318 | "assertTrue(${1:expr}${3:, ${2:msg=None}})", 319 | "" 320 | ], 321 | "description": "assertTrue", 322 | "prefix": "oo_assertTrue" 323 | }, 324 | "assertTupleEqual": { 325 | "body": [ 326 | "", 327 | "assertTupleEqual(${1:tuple1}, ${2:tuple2}${4:, ${3:msg=None}})", 328 | "" 329 | ], 330 | "description": "assertTupleEqual", 331 | "prefix": "oo_assertTupleEqual" 332 | }, 333 | "attr/_auto": { 334 | "body": [ 335 | "", 336 | "_auto = ${1:False}${0}", 337 | "" 338 | ], 339 | "description": "Adds the _auto attribute", 340 | "prefix": "oo_attr/_auto" 341 | }, 342 | "attr/_inherit": { 343 | "body": [ 344 | "", 345 | "_inherit = ['${1:ir.model}'${2}]${0}", 346 | "" 347 | ], 348 | "description": "Model attribute _inherit with a module list", 349 | "prefix": "oo_attr/_inherit" 350 | }, 351 | "attr/_inherits": { 352 | "body": [ 353 | "", 354 | "_inherits = {'${1:model_name}': '${2:related_id}'}${0}", 355 | "" 356 | ], 357 | "description": "Model attribute _inherits and single parent field", 358 | "prefix": "oo_attr/_inherits" 359 | }, 360 | "auto_join": { 361 | "body": [ 362 | "", 363 | "auto_join=${1:False}${0}", 364 | "" 365 | ], 366 | "description": "Field attribute: auto_join", 367 | "prefix": "oo_auto_join" 368 | }, 369 | "comodel_name": { 370 | "body": [ 371 | "", 372 | "comodel_name='${1:model_name}'${0}", 373 | "" 374 | ], 375 | "description": "Field attribute: comodel_name", 376 | "prefix": "oo_comodel_name" 377 | }, 378 | "company_dependent": { 379 | "body": [ 380 | "", 381 | "company_dependent=${1:True}${0}", 382 | "" 383 | ], 384 | "description": "Field attribute: company_dependent", 385 | "prefix": "oo_company_dependent" 386 | }, 387 | "compute": { 388 | "body": [ 389 | "", 390 | " compute='_compute_${1:field}' )", 391 | "", 392 | "@api.depends('${2:depends}')", 393 | "def _compute_${1:field}(self):", 394 | " for record in self:", 395 | " ${4:record.${1:field} = ${3:something}}", 396 | "", 397 | "${0}", 398 | "" 399 | ], 400 | "description": "Field attribute: compute", 401 | "prefix": "oo_compute" 402 | }, 403 | "compute_sudo": { 404 | "body": [ 405 | "", 406 | "compute_sudo=${1:True}${0}", 407 | "", 408 | "" 409 | ], 410 | "description": "Field attribute: compute_sudo", 411 | "prefix": "oo_compute_sudo" 412 | }, 413 | "constraints": { 414 | "body": [ 415 | "", 416 | "_sql_constraints = [", 417 | " (", 418 | " '${1:name}',", 419 | " '${2:constraint}',", 420 | " _('${3:message}')", 421 | " )${4}", 422 | "]${0}", 423 | "" 424 | ], 425 | "description": "Model SQL contraints", 426 | "prefix": "oo_constraints" 427 | }, 428 | "constraints1": { 429 | "body": [ 430 | "", 431 | "@api.constrains('${1}')", 432 | "def _check_${1}(self):", 433 | " for record in self:", 434 | " ${0}", 435 | "" 436 | ], 437 | "description": "Model Python contraints", 438 | "prefix": "oo_constraints" 439 | }, 440 | "context": { 441 | "body": [ 442 | "", 443 | "context=\\{${13}\\}${0}", 444 | "" 445 | ], 446 | "description": "Field attribute: context", 447 | "prefix": "oo_context" 448 | }, 449 | "controller/controller": { 450 | "body": [ 451 | "", 452 | "class ${1:ControllerName}(Controller):", 453 | " \"\"\" ${2:The summary line for a class docstring should fit on one line.}", 454 | "", 455 | " Routes:", 456 | " /${3:some_url}: ${4:url description}", 457 | " \"\"\"", 458 | "", 459 | " @route('/${3}', type='${5:http}', auth='${6:none}')", 460 | " def ${3/((^[A-Z])|([^a-zA-Z]))/${2:/downcase}${3:_}/g}(self${7:, **kw}):", 461 | "", 462 | " pass${0}", 463 | "" 464 | ], 465 | "description": "Odoo web controller class", 466 | "prefix": "oo_controller/controller" 467 | }, 468 | "controller/route": { 469 | "body": [ 470 | "", 471 | "\"\"\" ", 472 | " Routes:", 473 | " /${1:some_url}: ${2:url description}", 474 | "\"\"\"", 475 | "", 476 | "@route('/${1}', type='${3:http}', auth='${4:none}')", 477 | "def ${1/((^[A-Z])|([^a-zA-Z]))/${2:/downcase}${3:_}/g}(self${5:, **kw}):", 478 | "", 479 | " pass${0}", 480 | "" 481 | ], 482 | "description": "Odoo web controller route", 483 | "prefix": "oo_controller/route" 484 | }, 485 | "copy": { 486 | "body": [ 487 | "", 488 | "copy=${1:False}${0}", 489 | "" 490 | ], 491 | "description": "Field attribute: copy", 492 | "prefix": "oo_copy" 493 | }, 494 | "copyright": { 495 | "body": [ 496 | "", 497 | "# -*- coding: utf-8 -*-", 498 | "###############################################################################", 499 | "#", 500 | "# jeffery CHEN fan", 501 | "#", 502 | "# Copyright (c) All rights reserved:", 503 | "# (c) 2017 $TM_FULLNAME", 504 | "#", 505 | "# This program is free software: you can redistribute it and/or modify", 506 | "# it under the terms of the GNU Affero General Public License as", 507 | "# published by the Free Software Foundation, either version 3 of the", 508 | "# License, or (at your option) any later version.", 509 | "#", 510 | "# This program is distributed in the hope that it will be useful,", 511 | "# but WITHOUT ANY WARRANTY; without even the implied warranty of", 512 | "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", 513 | "# GNU Affero General Public License for more details.", 514 | "#", 515 | "# You should have received a copy of the GNU Affero General Public License", 516 | "# along with this program. If not, see http://www.gnu.org/licenses", 517 | "# ", 518 | "# Odoo and OpenERP is trademark of Odoo S.A.", 519 | "#", 520 | "###############################################################################", 521 | "${0}", 522 | "" 523 | ], 524 | "description": "Copyright statement Full", 525 | "prefix": "oo_copyright" 526 | }, 527 | "copyright1": { 528 | "body": [ 529 | "", 530 | "# -*- coding: utf-8 -*-", 531 | "###############################################################################", 532 | "# License, author and contributors information in: #", 533 | "# __manifest__.py file at the root folder of this module. #", 534 | "###############################################################################", 535 | "${0}", 536 | "" 537 | ], 538 | "description": "Copyright statement Simple", 539 | "prefix": "oo_copyright" 540 | }, 541 | "copyright2": { 542 | "body": [ 543 | "", 544 | "# -*- coding: utf-8 -*-", 545 | "###############################################################################", 546 | "#", 547 | "# jeffery CHEN fan", 548 | "#", 549 | "# Copyright (c) All rights reserved:", 550 | "# (c) 2017 $TM_FULLNAME", 551 | "#", 552 | "# This program is free software: you can redistribute it and/or modify", 553 | "# it under the terms of the GNU Affero General Public License as", 554 | "# published by the Free Software Foundation, either version 3 of the", 555 | "# License, or (at your option) any later version.", 556 | "#", 557 | "# This program is distributed in the hope that it will be useful,", 558 | "# but WITHOUT ANY WARRANTY; without even the implied warranty of", 559 | "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", 560 | "# GNU Affero General Public License for more details.", 561 | "#", 562 | "# You should have received a copy of the GNU Affero General Public License", 563 | "# along with this program. If not, see http://www.gnu.org/licenses", 564 | "# ", 565 | "# Odoo and OpenERP is trademark of Odoo S.A.", 566 | "#", 567 | "###############################################################################", 568 | "${0}", 569 | "" 570 | ], 571 | "description": "Copyright statement Full", 572 | "prefix": "oo_copyright" 573 | }, 574 | "def/log": { 575 | "body": [ 576 | "", 577 | "def _log(self, level, msg_format, *args, **kwargs):", 578 | " \"\"\" Outputs an formated string in log", 579 | "", 580 | " :param level (int): 1=> debug, 2=> info, 3=> warning, 4=> error", 581 | " :param message (basestring): name of the message", 582 | " \"\"\"", 583 | "", 584 | " methods = ['debug', 'info', 'warning', 'error']", 585 | " log = getattr(_logger, methods[level])", 586 | "", 587 | " msg = msg_format.format(*args, **kwargs)", 588 | " log(msg)", 589 | "" 590 | ], 591 | "description": "Common logging log method", 592 | "prefix": "oo_def/log" 593 | }, 594 | "default": { 595 | "body": [ 596 | "", 597 | "default='_default_${1:field}'${0}", 598 | "" 599 | ], 600 | "description": "Field attribute: search, lambda function", 601 | "prefix": "oo_default" 602 | }, 603 | "default company": { 604 | "body": [ 605 | "", 606 | "default=lambda self: self.env.user.company_id${0}", 607 | "" 608 | ], 609 | "description": "Field attribute: default company", 610 | "prefix": "oo_default company" 611 | }, 612 | "default user": { 613 | "body": [ 614 | "", 615 | "default=lambda self: self.env.user${0}", 616 | "" 617 | ], 618 | "description": "Field attribute: default user", 619 | "prefix": "oo_default user" 620 | }, 621 | "default_model": { 622 | "body": [ 623 | "", 624 | "default_model='${1:model.name}'${0}", 625 | "" 626 | ], 627 | "description": "Field attribute: default_model ", 628 | "prefix": "oo_default_model" 629 | }, 630 | "digits": { 631 | "body": [ 632 | "", 633 | "digits=(${1:16}, ${2:2})", 634 | "" 635 | ], 636 | "description": "Field attribute: digits", 637 | "prefix": "oo_digits" 638 | }, 639 | "digits/get_precision": { 640 | "body": [ 641 | "", 642 | "digits=dp.get_precision('Product Price')", 643 | "" 644 | ], 645 | "description": "Field attribute: digits", 646 | "prefix": "oo_digits/get_precision" 647 | }, 648 | "domain": { 649 | "body": [ 650 | "", 651 | "domain=[('${1}','${2|=,in,not in|',${3})]${0}", 652 | "" 653 | ], 654 | "description": "Field attribute: domain", 655 | "prefix": "oo_domain" 656 | }, 657 | "domain1": { 658 | "body": [ 659 | "", 660 | "domain=lambda self: self._get_${1:field}_domain}()", 661 | "" 662 | ], 663 | "description": "Field attribute: domain lambda", 664 | "prefix": "oo_domain" 665 | }, 666 | "fail": { 667 | "body": [ 668 | "", 669 | "fail(${1:msg=None})", 670 | "" 671 | ], 672 | "description": "fail", 673 | "prefix": "oo_fail" 674 | }, 675 | "feature/company_plant": { 676 | "body": [ 677 | "", 678 | "plant_id = fields.Many2one(", 679 | " string='Plant',", 680 | " comodel_name='res.company',", 681 | " required=True,", 682 | " default=lambda self: self.env.user.company_id,", 683 | " domain=lambda self: [('is_plant','=',True), ('id','in',self.env.user.company_ids.ids)],", 684 | ")", 685 | "", 686 | "company_id = fields.Many2one(", 687 | " string='Company',", 688 | " comodel_name='res.company',", 689 | " ondelete='set null',", 690 | " related='factory_id.parent_id',", 691 | ")", 692 | "", 693 | "" 694 | ], 695 | "description": "Adds the company/plant support", 696 | "prefix": "oo_feature/company_plant" 697 | }, 698 | "feature/mail_thread": { 699 | "body": [ 700 | "", 701 | "_inherit = ['mail.thread', 'mail.activity.mixin'${0}]", 702 | "", 703 | "" 704 | ], 705 | "description": "Adds Mail Thread support", 706 | "prefix": "oo_feature/mail_thread" 707 | }, 708 | "feature/multi_company": { 709 | "body": [ 710 | "", 711 | "company_ids = fields.Many2many(", 712 | " comodel_name='res.company', ", 713 | " string=\"Companies\" ", 714 | ")", 715 | "", 716 | "company_id = fields.Many2one(", 717 | " comodel_name='res.company', ", 718 | " compute=\"_compute_company_id\", ", 719 | " store=True,", 720 | ")", 721 | "", 722 | "@api.multi", 723 | "@api.depends('company_ids')", 724 | "def _compute_company_id(self):", 725 | " for record in self:", 726 | " record.company_id = record.company_ids[:1]", 727 | "", 728 | "" 729 | ], 730 | "description": "Adds the multi company support", 731 | "prefix": "oo_feature/multi_company" 732 | }, 733 | "feature/needaction": { 734 | "body": [ 735 | "", 736 | "'ir.needaction_mixin'${0}", 737 | "" 738 | ], 739 | "description": "Adds NeedAction support", 740 | "prefix": "oo_feature/needaction" 741 | }, 742 | "feature/parent_child": { 743 | "body": [ 744 | "", 745 | "_parent_store = ${1:True}", 746 | "${0}", 747 | "", 748 | "parent_left = fields.Integer('Left Parent', index=1)", 749 | "parent_right = fields.Integer('Right Parent', index=1)", 750 | "", 751 | "" 752 | ], 753 | "description": "Adds the _parent_store attribute and parent_left and parent_right", 754 | "prefix": "oo_feature/parent_child" 755 | }, 756 | "feature/status": { 757 | "body": [ 758 | "", 759 | "state = fields.Selection(", 760 | " string='State',", 761 | " selection=[('draft', 'Draft'), ('confirmed', 'Confirmed'), ('close', 'Close'), ('cancel', 'Cancel')],", 762 | " default='draft',", 763 | " readonly=True,", 764 | ")", 765 | "", 766 | "@api.multi", 767 | "def action_confirm(self):", 768 | " self.write({'state': 'confirmed'})", 769 | "", 770 | "@api.multi", 771 | "def action_draft(self):", 772 | " self.write({'state': 'draft'})", 773 | "", 774 | "@api.multi", 775 | "def action_cancel(self):", 776 | " self.write({'state': 'cancel'})", 777 | "", 778 | "@api.multi", 779 | "def action_close(self):", 780 | " self.write({'state': 'close'})", 781 | "", 782 | "${0}", 783 | "" 784 | ], 785 | "description": "Adds state support", 786 | "prefix": "oo_feature/status" 787 | }, 788 | "feature/utm": { 789 | "body": [ 790 | "", 791 | "'utm.mixin'${0}", 792 | "" 793 | ], 794 | "description": "Adds utm support", 795 | "prefix": "oo_feature/utm" 796 | }, 797 | "fields.simple": { 798 | "body": [ 799 | "", 800 | "${1:field_name} = fields.${9|Attachment,Binary,Boolean,Char,Date,Datetime,Float,Html,Image,Integer,Monetary,Text|}(", 801 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 802 | ")${0}", 803 | "" 804 | ], 805 | "description": "", 806 | "prefix": "oo_fields.simple" 807 | }, 808 | "fields.relation": { 809 | "body": [ 810 | "", 811 | "${1:field_name} = fields.${9|Many2one,Many2many,One2many,Reference|}(", 812 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 813 | ")${0}", 814 | "" 815 | ], 816 | "description": "", 817 | "prefix": "oo_fields.relation" 818 | }, 819 | "field.company_id": { 820 | "body": [ 821 | "", 822 | "company_id = fields.Many2one(", 823 | " string='Company', ", 824 | " comodel_name='res.company', ", 825 | " required=True, ", 826 | " default=lambda self: self.env.user.company_id", 827 | ")", 828 | "" 829 | ], 830 | "description": "", 831 | "prefix": "oo_field.company_id" 832 | }, 833 | "fields.Attachment": { 834 | "body": [ 835 | "", 836 | "${1:attachment} = fields.Binary(string='${3:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}', attachment=True)", 837 | "" 838 | ], 839 | "description": "", 840 | "prefix": "oo_fields.Attachment" 841 | }, 842 | "fields.Binary": { 843 | "body": [ 844 | "", 845 | "${1:field_name} = fields.Binary(", 846 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 847 | ")${0}", 848 | "" 849 | ], 850 | "description": "", 851 | "prefix": "oo_fields.Binary" 852 | }, 853 | "fields.Boolean": { 854 | "body": [ 855 | "", 856 | "${1:field_name} = fields.Boolean(", 857 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 858 | ")${0}", 859 | "" 860 | ], 861 | "description": "", 862 | "prefix": "oo_fields.Boolean" 863 | }, 864 | "fields.Char": { 865 | "body": [ 866 | "", 867 | "${1:field_name} = fields.Char(", 868 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 869 | ")${0}", 870 | "" 871 | ], 872 | "description": "", 873 | "prefix": "oo_fields.Char" 874 | }, 875 | "fields.Date": { 876 | "body": [ 877 | "", 878 | "${1:field_name} = fields.Date(", 879 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 880 | " default=${6:fields.Date.context_today},", 881 | ")${0}", 882 | "" 883 | ], 884 | "description": "", 885 | "prefix": "oo_fields.Date" 886 | }, 887 | "fields.Datetime": { 888 | "body": [ 889 | "", 890 | "${1:field_name} = fields.Datetime(", 891 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 892 | " default=${6:fields.Datetime.now},", 893 | ")${0}", 894 | "" 895 | ], 896 | "description": "", 897 | "prefix": "oo_fields.Datetime" 898 | }, 899 | "fields.Float": { 900 | "body": [ 901 | "", 902 | "${1:field_name} = fields.Float(", 903 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 904 | ")${0}", 905 | "" 906 | ], 907 | "description": "", 908 | "prefix": "oo_fields.Float" 909 | }, 910 | "fields.Html": { 911 | "body": [ 912 | "", 913 | "${1:field_name} = fields.Html(", 914 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 915 | ")${0}", 916 | "" 917 | ], 918 | "description": "", 919 | "prefix": "oo_fields.Html" 920 | }, 921 | "fields.Integer": { 922 | "body": [ 923 | "", 924 | "${1:field_name} = fields.Integer(", 925 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 926 | ")${0}", 927 | "" 928 | ], 929 | "description": "", 930 | "prefix": "oo_fields.Integer" 931 | }, 932 | "fields.Many2many": { 933 | "body": [ 934 | "", 935 | "${1:field_name}_ids = fields.Many2many(", 936 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 937 | " comodel_name='${8:model.name}',", 938 | " relation='${10:${8/\\./_/g}_${9:this_model}_rel}',", 939 | " column1='${11:${9/\\./_/g}_id}',", 940 | " column2='${12:${8/\\./_/g}_id}',", 941 | ")${0}", 942 | "" 943 | ], 944 | "description": "", 945 | "prefix": "oo_fields.Many2many" 946 | }, 947 | "fields.Many2one": { 948 | "body": [ 949 | "", 950 | "${1:field_name}_id = fields.Many2one(", 951 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 952 | " comodel_name='${8:model.name}',", 953 | " ondelete='${11:restrict}',", 954 | ")${0}", 955 | "" 956 | ], 957 | "description": "", 958 | "prefix": "oo_fields.Many2one" 959 | }, 960 | "fields.One2many": { 961 | "body": [ 962 | "", 963 | "${1:field_name}_ids = fields.One2many(", 964 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 965 | " comodel_name='${8:model.name}',", 966 | " inverse_name='${9:inverse_field}',", 967 | ")${0}", 968 | "" 969 | ], 970 | "description": "", 971 | "prefix": "oo_fields.One2many" 972 | }, 973 | "fields.Reference": { 974 | "body": [ 975 | "", 976 | "${1:field_name}_ref = fields.Reference(", 977 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 978 | " selection=[('${8:model.name}', '${9:String}'),('${10:model.name}', '${11:String}')]", 979 | ")${0}", 980 | "" 981 | ], 982 | "description": "", 983 | "prefix": "oo_fields.Reference" 984 | }, 985 | "fields.Selection": { 986 | "body": [ 987 | "", 988 | "${1:field_name} = fields.Selection(", 989 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 990 | " selection=[('${8:valor1}', '${9:${8/(.)(.+)/${1:/downcase}$2/g}}'), ('${10:valor2}', '${11:${10/(.)(.+)/${1:/downcase}$2/g}}')]", 991 | ")${0}", 992 | "" 993 | ], 994 | "description": "", 995 | "prefix": "oo_fields.Selection" 996 | }, 997 | "fields.Text": { 998 | "body": [ 999 | "", 1000 | "${1:field_name} = fields.Text(", 1001 | " string='${2:${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g}}',", 1002 | ")${0}", 1003 | "" 1004 | ], 1005 | "description": "", 1006 | "prefix": "oo_fields.Text" 1007 | }, 1008 | "file/__init__": { 1009 | "body": [ 1010 | "", 1011 | "# -*- coding: utf-8 -*-", 1012 | "###############################################################################", 1013 | "# License, author and contributors information in: #", 1014 | "# __manifest__.py file at the root folder of this module. #", 1015 | "###############################################################################", 1016 | "", 1017 | "from . import ${1:models}${0}", 1018 | "" 1019 | ], 1020 | "description": "__init__ file", 1021 | "prefix": "oo_file/__init__" 1022 | }, 1023 | "file/__manifest__": { 1024 | "body": [ 1025 | "", 1026 | "# -*- coding: utf-8 -*-", 1027 | "###############################################################################", 1028 | "#", 1029 | "# jeffery CHEN fan", 1030 | "#", 1031 | "# Copyright (c) All rights reserved:", 1032 | "# (c) 2017 $TM_FULLNAME", 1033 | "#", 1034 | "# This program is free software: you can redistribute it and/or modify", 1035 | "# it under the terms of the GNU Affero General Public License as", 1036 | "# published by the Free Software Foundation, either version 3 of the", 1037 | "# License, or (at your option) any later version.", 1038 | "#", 1039 | "# This program is distributed in the hope that it will be useful,", 1040 | "# but WITHOUT ANY WARRANTY; without even the implied warranty of", 1041 | "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", 1042 | "# GNU Affero General Public License for more details.", 1043 | "#", 1044 | "# You should have received a copy of the GNU Affero General Public License", 1045 | "# along with this program. If not, see http://www.gnu.org/licenses", 1046 | "# ", 1047 | "# Odoo and OpenERP is trademark of Odoo S.A.", 1048 | "#", 1049 | "###############################################################################", 1050 | "{", 1051 | " 'name': '${1:Human readable name}',", 1052 | " 'summary': '${2:${1}} Module Project',", 1053 | " 'version': '1.0',", 1054 | "", 1055 | " 'description': \"\"\"", 1056 | "${3:${1}} Module Project.", 1057 | "==============================================", 1058 | "", 1059 | "${4}", 1060 | " \"\"\",", 1061 | "", 1062 | " 'author': '${5:$TM_FULLNAME}',", 1063 | " 'maintainer': '${5}',", 1064 | " 'contributors': ['${6:${5} <${5}@gmail.com>}'],", 1065 | "", 1066 | " 'website': 'http://www.gitlab.com/${7:${5}}',", 1067 | "", 1068 | " 'license': 'AGPL-3',", 1069 | " 'category': 'Uncategorized',", 1070 | "", 1071 | " 'depends': [", 1072 | " 'base'", 1073 | " ],", 1074 | " 'external_dependencies': {", 1075 | " 'python': [", 1076 | " ],", 1077 | " },", 1078 | " 'data': [", 1079 | " ],", 1080 | " 'demo': [", 1081 | " ],", 1082 | " 'js': [", 1083 | " ],", 1084 | " 'css': [", 1085 | " ],", 1086 | " 'qweb': [", 1087 | " ],", 1088 | " 'images': [", 1089 | " ],", 1090 | " 'test': [", 1091 | " ],", 1092 | "", 1093 | " 'installable': True", 1094 | "}${0}", 1095 | "" 1096 | ], 1097 | "description": "Odoo manifest file common structure", 1098 | "prefix": "oo_file/__manifest__" 1099 | }, 1100 | "file/__manifest__1": { 1101 | "body": [ 1102 | "", 1103 | "# -*- coding: utf-8 -*-", 1104 | "###############################################################################", 1105 | "#", 1106 | "# jeffery CHEN fan", 1107 | "#", 1108 | "# Copyright (c) All rights reserved:", 1109 | "# (c) 2017 $TM_FULLNAME", 1110 | "#", 1111 | "# This program is free software: you can redistribute it and/or modify", 1112 | "# it under the terms of the GNU Affero General Public License as", 1113 | "# published by the Free Software Foundation, either version 3 of the", 1114 | "# License, or (at your option) any later version.", 1115 | "#", 1116 | "# This program is distributed in the hope that it will be useful,", 1117 | "# but WITHOUT ANY WARRANTY; without even the implied warranty of", 1118 | "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", 1119 | "# GNU Affero General Public License for more details.", 1120 | "#", 1121 | "# You should have received a copy of the GNU Affero General Public License", 1122 | "# along with this program. If not, see http://www.gnu.org/licenses", 1123 | "# ", 1124 | "# Odoo and OpenERP is trademark of Odoo S.A.", 1125 | "#", 1126 | "###############################################################################", 1127 | "{", 1128 | " 'name': '${1:Human readable name}',", 1129 | " 'summary': '${2:${1}} Module Project',", 1130 | " 'version': '1.0',", 1131 | "", 1132 | " 'description': \"\"\"", 1133 | "${3:${1}} Module Project.", 1134 | "==============================================", 1135 | "", 1136 | "${4}", 1137 | " \"\"\",", 1138 | "", 1139 | " 'author': '${5:$TM_FULLNAME}',", 1140 | " 'maintainer': '${5}',", 1141 | " 'contributors': ['${6:${5} <${5}@gmail.com>}'],", 1142 | "", 1143 | " 'website': 'http://www.gitlab.com/${7:${5}}',", 1144 | "", 1145 | " 'license': 'AGPL-3',", 1146 | " 'category': 'Uncategorized',", 1147 | "", 1148 | " 'depends': [", 1149 | " 'base'", 1150 | " ],", 1151 | " 'external_dependencies': {", 1152 | " 'python': [", 1153 | " ],", 1154 | " },", 1155 | " 'data': [", 1156 | " ],", 1157 | " 'demo': [", 1158 | " ],", 1159 | " 'js': [", 1160 | " ],", 1161 | " 'css': [", 1162 | " ],", 1163 | " 'qweb': [", 1164 | " ],", 1165 | " 'images': [", 1166 | " ],", 1167 | " 'test': [", 1168 | " ],", 1169 | "", 1170 | " 'installable': True", 1171 | "}${0}", 1172 | "" 1173 | ], 1174 | "description": "Odoo manifest file common structure", 1175 | "prefix": "oo_file/__manifest__" 1176 | }, 1177 | "file/__openerp__": { 1178 | "body": [ 1179 | "", 1180 | "# -*- coding: utf-8 -*-", 1181 | "###############################################################################", 1182 | "#", 1183 | "# Odoo, Open Source Management Solution", 1184 | "#", 1185 | "# Copyright (c) All rights reserved:", 1186 | "# (c) 2017 $TM_FULLNAME", 1187 | "#", 1188 | "# This program is free software: you can redistribute it and/or modify", 1189 | "# it under the terms of the GNU Affero General Public License as", 1190 | "# published by the Free Software Foundation, either version 3 of the", 1191 | "# License, or (at your option) any later version.", 1192 | "#", 1193 | "# This program is distributed in the hope that it will be useful,", 1194 | "# but WITHOUT ANY WARRANTY; without even the implied warranty of", 1195 | "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", 1196 | "# GNU Affero General Public License for more details.", 1197 | "#", 1198 | "# You should have received a copy of the GNU Affero General Public License", 1199 | "# along with this program. If not, see http://www.gnu.org/licenses", 1200 | "# ", 1201 | "# Odoo and OpenERP is trademark of Odoo S.A.", 1202 | "#", 1203 | "###############################################################################", 1204 | "{", 1205 | " 'name': '${1:Human readable name}',", 1206 | " 'summary': '${2:${1}} Module Project',", 1207 | " 'version': '1.0',", 1208 | "", 1209 | " 'description': \"\"\"", 1210 | "${3:${1}} Module Project.", 1211 | "==============================================", 1212 | "", 1213 | "${4}", 1214 | " \"\"\",", 1215 | "", 1216 | " 'author': '${5:$TM_FULLNAME}',", 1217 | " 'maintainer': '${5}',", 1218 | " 'contributors': ['${6:${5} <${5}@gmail.com>}'],", 1219 | "", 1220 | " 'website': 'http://www.gitlab.com/${7:${5}}',", 1221 | "", 1222 | " 'license': 'AGPL-3',", 1223 | " 'category': 'Uncategorized',", 1224 | "", 1225 | " 'depends': [", 1226 | " 'base'", 1227 | " ],", 1228 | " 'external_dependencies': {", 1229 | " 'python': [", 1230 | " ],", 1231 | " },", 1232 | " 'data': [", 1233 | " ],", 1234 | " 'demo': [", 1235 | " ],", 1236 | " 'js': [", 1237 | " ],", 1238 | " 'css': [", 1239 | " ],", 1240 | " 'qweb': [", 1241 | " ],", 1242 | " 'images': [", 1243 | " ],", 1244 | " 'test': [", 1245 | " ],", 1246 | "", 1247 | " 'installable': True", 1248 | "}${0}", 1249 | "" 1250 | ], 1251 | "description": "Odoo manifest file common structure", 1252 | "prefix": "oo_file/__openerp__" 1253 | }, 1254 | "file/coding": { 1255 | "body": [ 1256 | "", 1257 | "# -*- coding: utf-8 -*-", 1258 | "${0}", 1259 | "" 1260 | ], 1261 | "description": "utf-8 coding", 1262 | "prefix": "oo_file/coding" 1263 | }, 1264 | "file/controller": { 1265 | "body": [ 1266 | "", 1267 | "# -*- coding: utf-8 -*-", 1268 | "###############################################################################", 1269 | "# License, author and contributors information in: #", 1270 | "# __manifest__.py file at the root folder of this module. #", 1271 | "###############################################################################", 1272 | "", 1273 | "from odoo.http import route, request, Controller, _", 1274 | "from odoo.exceptions import UserError, ValidationError", 1275 | "${0}", 1276 | "" 1277 | ], 1278 | "description": "Odoo web controller file", 1279 | "prefix": "oo_file/controller" 1280 | }, 1281 | "file/model": { 1282 | "body": [ 1283 | "", 1284 | "# -*- coding: utf-8 -*-", 1285 | "###############################################################################", 1286 | "# License, author and contributors information in: #", 1287 | "# __manifest__.py file at the root folder of this module. #", 1288 | "###############################################################################", 1289 | "", 1290 | "from odoo import models, fields, api, _", 1291 | "from odoo.exceptions import UserError, ValidationError", 1292 | "${0}", 1293 | "" 1294 | ], 1295 | "description": "Odoo model file", 1296 | "prefix": "oo_file/model" 1297 | }, 1298 | "help": { 1299 | "body": [ 1300 | "", 1301 | "help='${1:Technical Field }'${0}", 1302 | "" 1303 | ], 1304 | "description": "Field attribute: help", 1305 | "prefix": "oo_help" 1306 | }, 1307 | "import/datetime": { 1308 | "body": [ 1309 | "", 1310 | "from datetime import date, datetime", 1311 | "from dateutil.relativedelta import relativedelta", 1312 | "from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DATE_FORMAT", 1313 | "from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT as DATETIME_FORMAT", 1314 | "${0}", 1315 | "" 1316 | ], 1317 | "description": "import date and time tools", 1318 | "prefix": "oo_import/datetime" 1319 | }, 1320 | "import/dp": { 1321 | "body": [ 1322 | "", 1323 | "import odoo.addons.decimal_precision as dp", 1324 | "${0}", 1325 | "" 1326 | ], 1327 | "description": "", 1328 | "prefix": "oo_import/dp" 1329 | }, 1330 | "import/exceptions": { 1331 | "body": [ 1332 | "", 1333 | "from odoo.exceptions import UserError, ValidationError", 1334 | "${0}", 1335 | "" 1336 | ], 1337 | "description": "", 1338 | "prefix": "oo_import/exceptions" 1339 | }, 1340 | "import/logging": { 1341 | "body": [ 1342 | "", 1343 | "import logging", 1344 | "_logger = logging.getLogger(__name__)", 1345 | "${0}", 1346 | "" 1347 | ], 1348 | "description": "logging instance", 1349 | "prefix": "oo_import/logging" 1350 | }, 1351 | "import/translate": { 1352 | "body": [ 1353 | "", 1354 | "from odoo.tools.translate import _${0}", 1355 | "" 1356 | ], 1357 | "description": "import odoo translate", 1358 | "prefix": "oo_import/translate" 1359 | }, 1360 | "index": { 1361 | "body": [ 1362 | "", 1363 | "index=${1:True}${0}", 1364 | "" 1365 | ], 1366 | "description": "Field attribute: index", 1367 | "prefix": "oo_index" 1368 | }, 1369 | "inverse": { 1370 | "body": [ 1371 | "", 1372 | "inverse='_inverse_${1:field}'${0}", 1373 | "" 1374 | ], 1375 | "description": "Field attribute: inverse, lambda function", 1376 | "prefix": "oo_inverse" 1377 | }, 1378 | "limit": { 1379 | "body": [ 1380 | "", 1381 | "limit=${1:80}${0}", 1382 | "" 1383 | ], 1384 | "description": "Field attribute: limit", 1385 | "prefix": "oo_limit" 1386 | }, 1387 | "method/_browse": { 1388 | "body": [ 1389 | "", 1390 | "@classmethod", 1391 | "def _browse(cls, env, ids):", 1392 | " \"\"\" Returns a recordset for the ids provided as parameter in the current", 1393 | " environment.", 1394 | "", 1395 | " Can take no ids, a single id or a sequence of ids.", 1396 | "", 1397 | " :param cls: model class", 1398 | " :param env: environment", 1399 | " :param ids: none, a single id or a sequence of ids", 1400 | "", 1401 | " :return: a recordset", 1402 | " \"\"\"", 1403 | "", 1404 | " result = ${1:class_name}._browse(env, ids)", 1405 | " ${0}", 1406 | " return result", 1407 | "" 1408 | ], 1409 | "description": "_browse method signature", 1410 | "prefix": "oo_method/_browse" 1411 | }, 1412 | "method/_onchange": { 1413 | "body": [ 1414 | "", 1415 | "@api.onchange('${1:field}')", 1416 | "def _onchange_${1}(self):", 1417 | " ${3:self.${2:field} = self.${1}}", 1418 | "${0}", 1419 | "" 1420 | ], 1421 | "description": "_onchange method signature, code", 1422 | "prefix": "oo_method/_onchange" 1423 | }, 1424 | "method/_onchange1": { 1425 | "body": [ 1426 | "", 1427 | "@api.onchange('${1:field_name}')", 1428 | "def _onchange_${1}(self):", 1429 | " return {", 1430 | " 'domain': {", 1431 | " '${2:field_name}': ${6:[('${3:field_name}', '${4:=}', ${5:self.${1}})]}", 1432 | " }", 1433 | " }${0}", 1434 | "" 1435 | ], 1436 | "description": "_onchange method signature, domain", 1437 | "prefix": "oo_method/_onchange" 1438 | }, 1439 | "method/_onchange2": { 1440 | "body": [ 1441 | "", 1442 | "@api.onchange('${1:field}')", 1443 | "def _onchange_${1}(self):", 1444 | " return {", 1445 | " 'warning': {", 1446 | " 'title': '${2:Text of the title}',", 1447 | " 'message': '${3:Text of the message}'", 1448 | " }", 1449 | " }${0}", 1450 | "" 1451 | ], 1452 | "description": "_onchange method signature, warning", 1453 | "prefix": "oo_method/_onchange" 1454 | }, 1455 | "method/_search": { 1456 | "body": [ 1457 | "", 1458 | "def _search_${1: field}(self, operator, value):", 1459 | " return [('${2:related}', operator, value)]${0}", 1460 | "" 1461 | ], 1462 | "description": "_search method signature", 1463 | "prefix": "oo_method/_search" 1464 | }, 1465 | "method/action_confirm": { 1466 | "body": [ 1467 | "", 1468 | "@api.multi", 1469 | "def action_confirm(self):", 1470 | " for record in self:", 1471 | " record.write( { '${1:field}': '${2:value}'})", 1472 | " return True", 1473 | "${0}", 1474 | "" 1475 | ], 1476 | "description": "action_confirm method signature", 1477 | "prefix": "oo_method/action_confirm" 1478 | }, 1479 | "method/compute": { 1480 | "body": [ 1481 | "", 1482 | "@api.depends('${2:depends}')", 1483 | "def _compute_${1:field}(self):", 1484 | " for record in self:", 1485 | " ${4:record.${1:field} = ${3:something}}", 1486 | "${0}", 1487 | "" 1488 | ], 1489 | "description": "_compute method signature", 1490 | "prefix": "oo_method/compute" 1491 | }, 1492 | "method/copy": { 1493 | "body": [ 1494 | "", 1495 | "@api.multi", 1496 | "def copy(self, default=None):", 1497 | " \"\"\"", 1498 | " Create a new record in ${1:ModelName} model from existing one", 1499 | " @param default: dict which contains the values to be override during", 1500 | " copy of object", 1501 | "", 1502 | " @return: returns a id of newly created record", 1503 | " \"\"\"", 1504 | "", 1505 | " result = super(${1:ModelName}, self).copy(default)", 1506 | " ${0}", 1507 | "", 1508 | " return result", 1509 | "" 1510 | ], 1511 | "description": "copy method signature", 1512 | "prefix": "oo_method/copy" 1513 | }, 1514 | "method/create": { 1515 | "body": [ 1516 | "", 1517 | "@api.model", 1518 | "def create(self, values):", 1519 | " \"\"\"", 1520 | " Create a new record for a model ${1:ModelName}", 1521 | " @param values: provides a data for new record", 1522 | "", 1523 | " @return: returns a id of new record", 1524 | " \"\"\"", 1525 | "", 1526 | " result = super(${1:Model_Name}, self).create(values)${0}", 1527 | "", 1528 | " return result", 1529 | "" 1530 | ], 1531 | "description": "create method signature", 1532 | "prefix": "oo_method/create" 1533 | }, 1534 | "method/default_get": { 1535 | "body": [ 1536 | "", 1537 | "@api.model", 1538 | "def default_get(self, fields):", 1539 | " res = super(${1:ModelClass}, self).default_get(fields)", 1540 | " ${0}", 1541 | "", 1542 | " return res", 1543 | " ", 1544 | "" 1545 | ], 1546 | "description": "default_get method signature", 1547 | "prefix": "oo_method/default_get" 1548 | }, 1549 | "method/fields_get": { 1550 | "body": [ 1551 | "", 1552 | "@api.model", 1553 | "def fields_get(self, allfields=None, attributes=None):", 1554 | " fields_to_hide = []", 1555 | " for fname, field in self._fields.items():", 1556 | " if fname.startswith('${2:prefix}'):", 1557 | " fields_to_hide.append(fname)", 1558 | "", 1559 | " res = super(${1:Model}, self).fields_get(allfields, attributes)", 1560 | "", 1561 | " for field in fields_to_hide:", 1562 | "", 1563 | " res[field]['searchable'] = False", 1564 | " res[field]['sortable'] = False", 1565 | "", 1566 | " return res", 1567 | "${0}", 1568 | "" 1569 | ], 1570 | "description": "fields_get remove fields from search and groubby", 1571 | "prefix": "oo_method/fields_get" 1572 | }, 1573 | "method/get_empty_list_help": { 1574 | "body": [ 1575 | "", 1576 | "@api.model", 1577 | "def get_empty_list_help(self, help):", 1578 | " \"\"\" Generic method giving the help message displayed when having", 1579 | " no result to display in a list or kanban view.", 1580 | " \"\"\"", 1581 | "", 1582 | " ${0:return help}", 1583 | "" 1584 | ], 1585 | "description": "get_empty_list_help method signature", 1586 | "prefix": "oo_method/get_empty_list_help" 1587 | }, 1588 | "method/get_formview_id": { 1589 | "body": [ 1590 | "", 1591 | "@api.one", 1592 | "@api.returns('ir.ui.view')", 1593 | "def get_formview_id(self):", 1594 | " \"\"\" Return an view id to open the document with.", 1595 | "", 1596 | " :param int id: id of the document to open", 1597 | " \"\"\"", 1598 | "", 1599 | " ${0:return False}", 1600 | "" 1601 | ], 1602 | "description": "get_formview_id method signature", 1603 | "prefix": "oo_method/get_formview_id" 1604 | }, 1605 | "method/init": { 1606 | "body": [ 1607 | "", 1608 | "def init(self):", 1609 | " \"\"\" Build database view which will be used as module origin", 1610 | "", 1611 | " \"\"\"", 1612 | " self._sql_query = \"\"\"", 1613 | " SELECT", 1614 | " ROW_NUMBER() OVER() AS \"id\"", 1615 | " \"\"\"", 1616 | "", 1617 | " tools.drop_view_if_exists(self._cr, ${1:self._table})", 1618 | " self._cr.execute(", 1619 | " 'create or replace view {} as ({})'.format(", 1620 | " ${1},", 1621 | " self._sql_query", 1622 | " )", 1623 | " )${0}", 1624 | "" 1625 | ], 1626 | "description": "init method signature", 1627 | "prefix": "oo_method/init" 1628 | }, 1629 | "method/name_get": { 1630 | "body": [ 1631 | "", 1632 | "@api.multi", 1633 | "@api.depends('name', '${1:ref}')", 1634 | "def name_get(self):", 1635 | " result = []", 1636 | " for record in self:", 1637 | " if record.${1:ref}:", 1638 | " name = '[' + record.${1:ref} + '] ' + record.name", 1639 | " else:", 1640 | " name = record.name", 1641 | " result.append((record.id, name))", 1642 | " return result", 1643 | "${0}", 1644 | "" 1645 | ], 1646 | "description": "name_get method signature", 1647 | "prefix": "oo_method/name_get" 1648 | }, 1649 | "method/name_search": { 1650 | "body": [ 1651 | "", 1652 | "@api.model", 1653 | "def name_search(self, name, args=None, operator='ilike', limit=100):", 1654 | " args = args or []", 1655 | " domain = []", 1656 | " if name:", 1657 | " domain = [", 1658 | " '|', ('${1:field_name}', '=ilike', name), ('${2:field_name}', operator, name)", 1659 | " ]", 1660 | " if operator in expression.NEGATIVE_TERM_OPERATORS:", 1661 | " domain = ['&', '!'] + domain[1:]", 1662 | " records = self.search(domain + args, limit=limit)", 1663 | " return records.name_get()", 1664 | "", 1665 | "${0}", 1666 | "" 1667 | ], 1668 | "description": "name_search method signature", 1669 | "prefix": "oo_method/name_search" 1670 | }, 1671 | "method/toggle_active": { 1672 | "body": [ 1673 | "", 1674 | "@api.multi", 1675 | "def toggle_active(self):", 1676 | " return {'warning': {", 1677 | " 'title': _(\"Warning\"),", 1678 | " 'message': _(u\"It is not allowed to \"archive\" records of this model!\") ,", 1679 | " }}", 1680 | "${0}", 1681 | "" 1682 | ], 1683 | "description": "toggle_active method signature", 1684 | "prefix": "oo_method/toggle_active" 1685 | }, 1686 | "method/unlink": { 1687 | "body": [ 1688 | "", 1689 | "@api.multi", 1690 | "def unlink(self):", 1691 | " \"\"\"", 1692 | " Delete all record(s) from recordset", 1693 | " return True on success, False otherwise", 1694 | "", 1695 | " @return: True on success, False otherwise", 1696 | "", 1697 | " #TODO: process before delete resource", 1698 | " \"\"\"", 1699 | "", 1700 | " result = super(${1:ModelName}, self).unlink()${0}", 1701 | "", 1702 | " return result", 1703 | "" 1704 | ], 1705 | "description": "unlink method signature", 1706 | "prefix": "oo_method/unlink" 1707 | }, 1708 | "method/unlink_restrict": { 1709 | "body": [ 1710 | "", 1711 | "@api.multi", 1712 | "def unlink(self):", 1713 | " for record in self:", 1714 | " if record.state not in ('draft'):", 1715 | " raise UserError(", 1716 | " 'You cannot delete a document which is not draft or cancelled!'", 1717 | " )", 1718 | " return super(ModelClass, self).unlink()", 1719 | "" 1720 | ], 1721 | "description": "restrict unlink", 1722 | "prefix": "oo_method/unlink_restrict" 1723 | }, 1724 | "method/view_header_get": { 1725 | "body": [ 1726 | "", 1727 | "@api.model", 1728 | "def view_header_get(self, view_id=None, view_type='form'):", 1729 | " \"\"\" Returns the window title which depends on the context \"\"\"", 1730 | "", 1731 | " ${0:return False}", 1732 | "" 1733 | ], 1734 | "description": "view_header_get method signature", 1735 | "prefix": "oo_method/view_header_get" 1736 | }, 1737 | "method/view_init": { 1738 | "body": [ 1739 | "", 1740 | "@api.model", 1741 | "def view_init(self, fields_list):", 1742 | " \"\"\" Does specific things when a view on the object is opened \"\"\"", 1743 | "", 1744 | " ${0:pass}", 1745 | "" 1746 | ], 1747 | "description": "view_init method signature", 1748 | "prefix": "oo_method/view_init" 1749 | }, 1750 | "method/write": { 1751 | "body": [ 1752 | "", 1753 | "@api.multi", 1754 | "def write(self, values):", 1755 | " \"\"\"", 1756 | " Update all record(s) in recordset, with new value comes as {values}", 1757 | " return True on success, False otherwise", 1758 | "", 1759 | " @param values: dict of new values to be set", 1760 | "", 1761 | " @return: True on success, False otherwise", 1762 | " \"\"\"", 1763 | "", 1764 | " result = super(${1:Model_Name}, self).write(values)${0}", 1765 | "", 1766 | " return result", 1767 | "" 1768 | ], 1769 | "description": "write method signature", 1770 | "prefix": "oo_method/write" 1771 | }, 1772 | "model/abstract": { 1773 | "body": [ 1774 | "", 1775 | "class ${1:ModelName}(models.AbstractModel):", 1776 | " _name = '${3:${1/(.+?)([A-Z])/${1:/downcase}.${2:/downcase}/g}}'", 1777 | "", 1778 | " ${0}", 1779 | "" 1780 | ], 1781 | "description": "Odoo abstract model class", 1782 | "prefix": "oo_model/abstract" 1783 | }, 1784 | "model/inherit": { 1785 | "body": [ 1786 | "", 1787 | "class ${1:ModelName}(models.Model):", 1788 | " _inherit = '${3:${1/(.+?)([A-Z])/${1:/downcase}.${2:/downcase}/g}}'", 1789 | "", 1790 | " ${0}", 1791 | "" 1792 | ], 1793 | "description": "Odoo inherit model class", 1794 | "prefix": "oo_model/inherit" 1795 | }, 1796 | "model/model": { 1797 | "body": [ 1798 | "", 1799 | "class ${1:ModelName}(models.Model):", 1800 | " _name = '${3:${1/(.+?)([A-Z])/${1:/downcase}.${2:/downcase}/g}}'", 1801 | " _description = '${4:${1/(.+?)([A-Z])/${1:/capitalize} ${2:/capitalize}/g}}'", 1802 | "", 1803 | " _rec_name = 'name'", 1804 | " _order = 'name ASC'", 1805 | "", 1806 | " name = fields.Char(", 1807 | " string='Name',", 1808 | " required=True,", 1809 | " default=lambda self: _('New'),", 1810 | " copy=False", 1811 | " )", 1812 | "", 1813 | " ${0}", 1814 | "" 1815 | ], 1816 | "description": "Odoo generic model class", 1817 | "prefix": "oo_model/model" 1818 | }, 1819 | "model/transient": { 1820 | "body": [ 1821 | "", 1822 | "class ${1:ModelName}(models.TransientModel):", 1823 | " _name = '${3:${1/(.+?)([A-Z])/${1:/downcase}.${2:/downcase}/g}}'", 1824 | " _description = '${4:${1/(.+?)([A-Z])/${1:/capitalize} ${2:/capitalize}/g}}'", 1825 | "", 1826 | " ${0}", 1827 | "" 1828 | ], 1829 | "description": "Odoo transient model class", 1830 | "prefix": "oo_model/transient" 1831 | }, 1832 | "ondelete": { 1833 | "body": [ 1834 | "", 1835 | "ondelete='${1:set null}'${0}", 1836 | "" 1837 | ], 1838 | "description": "Field attribute: ondelete", 1839 | "prefix": "oo_ondelete" 1840 | }, 1841 | "oodict/stock_move/~12": { 1842 | "body": [ 1843 | "", 1844 | "{", 1845 | " 'name': self.name,", 1846 | " 'product_id': self.product_id.id,", 1847 | " 'product_uom': self.product_uom.id or", 1848 | " self.product_id.uom_id.id,", 1849 | " 'product_uom_qty': self.product_qty,", 1850 | " 'partner_id': self.partner_id and", 1851 | " self.partner_id.id or False,", 1852 | " 'location_id': self.location_dest_id.id,", 1853 | " 'location_dest_id': self.location_dest_id.id,", 1854 | " 'move_line_ids': [(0, 0, {", 1855 | " 'product_id': self.product_id.id,", 1856 | " 'lot_id': self.lot_id.id,", 1857 | " 'product_uom_qty': self.product_qty,", 1858 | " 'product_uom_id': self.product_uom.id or", 1859 | " self.product_id.uom_id.id,", 1860 | " 'qty_done': self.product_qty,", 1861 | " 'package_id': False,", 1862 | " 'result_package_id': False,", 1863 | " 'location_id': self.location_dest_id.id,", 1864 | " 'location_dest_id': self.location_dest_id.id})]}", 1865 | "${0}", 1866 | "" 1867 | ], 1868 | "description": "", 1869 | "prefix": "oo_oodict/stock_move/~12" 1870 | }, 1871 | "readonly": { 1872 | "body": [ 1873 | "", 1874 | "readonly=True${0} ", 1875 | "" 1876 | ], 1877 | "description": "Field attribute: readonly", 1878 | "prefix": "oo_readonly" 1879 | }, 1880 | "readonly/states": { 1881 | "body": [ 1882 | "", 1883 | "readonly=True, states={'draft': [('readonly', False)]}${0} ", 1884 | "" 1885 | ], 1886 | "description": "Field attribute: readonly states", 1887 | "prefix": "oo_readonly/states" 1888 | }, 1889 | "related": { 1890 | "body": [ 1891 | "", 1892 | "related='${1:field_name}',", 1893 | "readonly=True,", 1894 | "store=True${0}", 1895 | "" 1896 | ], 1897 | "description": "Field attribute: related", 1898 | "prefix": "oo_related" 1899 | }, 1900 | "related_sudo": { 1901 | "body": [ 1902 | "", 1903 | "related_sudo=${1:False}${0}", 1904 | "" 1905 | ], 1906 | "description": "Field attribute: related_sudo", 1907 | "prefix": "oo_related_sudo" 1908 | }, 1909 | "required": { 1910 | "body": [ 1911 | "", 1912 | "required=${1:True}${0}", 1913 | "" 1914 | ], 1915 | "description": "Field attribute: required", 1916 | "prefix": "oo_required" 1917 | }, 1918 | "return/act_window": { 1919 | "body": [ 1920 | "", 1921 | "return {", 1922 | " 'name': _('${1: Human Readable String}'),", 1923 | " 'type': 'ir.actions.act_window',", 1924 | " 'view_type': 'form',", 1925 | " 'view_mode': 'tree,form',", 1926 | " 'res_model': '${2:model}',", 1927 | " 'domain': [('id', 'in', ${3:ids})],", 1928 | "}${0}", 1929 | "" 1930 | ], 1931 | "description": "pop window", 1932 | "prefix": "oo_return/act_window" 1933 | }, 1934 | "return/act_window_close": { 1935 | "body": [ 1936 | "", 1937 | "return {'type': 'ir.actions.act_window_close'${0}", 1938 | "" 1939 | ], 1940 | "description": "close window", 1941 | "prefix": "oo_return/act_window_close" 1942 | }, 1943 | "selection_add": { 1944 | "body": [ 1945 | "", 1946 | "selection_add=[('${1:draft}', ${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g})${0}]", 1947 | "" 1948 | ], 1949 | "description": "Field attribute: selection_add ", 1950 | "prefix": "oo_selection_add" 1951 | }, 1952 | "selection_element": { 1953 | "body": [ 1954 | "", 1955 | "('${1:draft}', ${1/(.*?)_([a-zA-Z])/${1:/capitalize} ${2:/capitalize}/g})${0}", 1956 | "" 1957 | ], 1958 | "description": "Field attribute: selection add new element ", 1959 | "prefix": "oo_selection_element" 1960 | }, 1961 | "sequence/line_number": { 1962 | "body": [ 1963 | "", 1964 | "line_number = fields.Integer(string='Line Number', default=10)", 1965 | "", 1966 | "@api.model", 1967 | "def default_get(self, fields):", 1968 | " default_values = super(${1:ModelClass}, self).default_get(fields)", 1969 | "", 1970 | " line_ids = self.env.context.get('${2:line_ids}', False)", 1971 | " if line_ids:", 1972 | " lines = self.env['${3:model}'].resolve_2many_commands(", 1973 | " '${2:line_ids}', line_ids", 1974 | " )", 1975 | " lines.sort(key=lambda x:x.get('line_number'))", 1976 | "", 1977 | " if lines:", 1978 | " sequence = lines[-1]['line_number'] + 10", 1979 | " else:", 1980 | " sequence = 10", 1981 | "", 1982 | " default_values.update({'line_number': sequence})", 1983 | "", 1984 | " return default_values", 1985 | "", 1986 | "" 1987 | ], 1988 | "description": "Line Number Add 10 automaticlly", 1989 | "prefix": "oo_sequence/line_number" 1990 | }, 1991 | "sequence/next_by_code": { 1992 | "body": [ 1993 | "", 1994 | "if values.get('name', _('New')) == _('New'):", 1995 | " if 'company_id' in values:", 1996 | " values['name'] = self.env['ir.sequence'].with_context(", 1997 | " force_company=values['company_id']", 1998 | " ).next_by_code('${1:model}') or _('New')", 1999 | " else:", 2000 | " values['name'] = self.env['ir.sequence'].next_by_code(", 2001 | " '${1:model}'", 2002 | " ) or _('New')", 2003 | "", 2004 | "" 2005 | ], 2006 | "description": "next_by_code, used in create()", 2007 | "prefix": "oo_sequence/next_by_code" 2008 | }, 2009 | "size": { 2010 | "body": [ 2011 | "", 2012 | "size=${1:32}${0}", 2013 | "" 2014 | ], 2015 | "description": "Field attribute: size", 2016 | "prefix": "oo_size" 2017 | }, 2018 | "states": { 2019 | "body": [ 2020 | "", 2021 | "states={'${1:state}': [${0}]}", 2022 | "" 2023 | ], 2024 | "description": "Field attribute: states", 2025 | "prefix": "oo_states" 2026 | }, 2027 | "states/invisible": { 2028 | "body": [ 2029 | "", 2030 | "(invisible, True)${0}", 2031 | "" 2032 | ], 2033 | "description": "Field attribute: states state invisible", 2034 | "prefix": "oo_states/invisible" 2035 | }, 2036 | "states/readonly": { 2037 | "body": [ 2038 | "", 2039 | "(readonly, True)${0}", 2040 | "" 2041 | ], 2042 | "description": "Field attribute: states state readonly", 2043 | "prefix": "oo_states/readonly" 2044 | }, 2045 | "states/required": { 2046 | "body": [ 2047 | "", 2048 | "(required, True)${0}", 2049 | "" 2050 | ], 2051 | "description": "Field attribute: states state required", 2052 | "prefix": "oo_states/required" 2053 | }, 2054 | "states/state": { 2055 | "body": [ 2056 | "", 2057 | "${1:state}': [${0}]", 2058 | "" 2059 | ], 2060 | "description": "Field attribute: states state", 2061 | "prefix": "oo_states/state" 2062 | }, 2063 | "store": { 2064 | "body": [ 2065 | "", 2066 | "store=${1:True}${0}", 2067 | "" 2068 | ], 2069 | "description": "Field attribute: store", 2070 | "prefix": "oo_store" 2071 | }, 2072 | "string": { 2073 | "body": [ 2074 | "", 2075 | "string='${1}'${0}", 2076 | "" 2077 | ], 2078 | "description": "Field attribute: string", 2079 | "prefix": "oo_string" 2080 | }, 2081 | "super": { 2082 | "body": [ 2083 | "", 2084 | "super(${1:ModelClass}, self).${2:handler}(${3})", 2085 | "" 2086 | ], 2087 | "description": "Call Python parent class", 2088 | "prefix": "oo_super" 2089 | }, 2090 | "test": { 2091 | "body": [ 2092 | "", 2093 | "def test_${1:item_name}(self):", 2094 | " \"\"\" Checks if the ${1} works properly", 2095 | " \"\"\"", 2096 | "", 2097 | " ${0:pass}", 2098 | "" 2099 | ], 2100 | "description": "Test case method", 2101 | "prefix": "oo_test" 2102 | }, 2103 | "track_visibility": { 2104 | "body": [ 2105 | "", 2106 | "track_visibility='${1:onchange}'${0}", 2107 | "" 2108 | ], 2109 | "description": "Field attribute: track_visibility", 2110 | "prefix": "oo_track_visibility" 2111 | }, 2112 | "translate": { 2113 | "body": [ 2114 | "", 2115 | "translate=${1:False}${0}", 2116 | "" 2117 | ], 2118 | "description": "Field attribute: translate", 2119 | "prefix": "oo_translate" 2120 | }, 2121 | "x2m/create": { 2122 | "body": [ 2123 | "", 2124 | "(0, False, ${1:{values}})", 2125 | "" 2126 | ], 2127 | "description": "x2m create", 2128 | "prefix": "oo_x2m/create" 2129 | }, 2130 | "x2m/delete": { 2131 | "body": [ 2132 | "", 2133 | "(2, ${1:id}, False)", 2134 | "" 2135 | ], 2136 | "description": "x2m delete, don't use in create()", 2137 | "prefix": "oo_x2m/delete" 2138 | }, 2139 | "x2m/link": { 2140 | "body": [ 2141 | "", 2142 | "(4, ${1:id}, False)", 2143 | "" 2144 | ], 2145 | "description": "x2m link, don't use in One2many", 2146 | "prefix": "oo_x2m/link" 2147 | }, 2148 | "x2m/replace": { 2149 | "body": [ 2150 | "", 2151 | "(6, False, ${1:ids)", 2152 | "" 2153 | ], 2154 | "description": "x2m replace, don't use in create() and One2many", 2155 | "prefix": "oo_x2m/replace" 2156 | }, 2157 | "x2m/unlink": { 2158 | "body": [ 2159 | "", 2160 | "(3, ${1:id}, False)", 2161 | "" 2162 | ], 2163 | "description": "x2m unlink, don't use in create()", 2164 | "prefix": "oo_x2m/unlink" 2165 | }, 2166 | "x2m/unlink_all": { 2167 | "body": [ 2168 | "", 2169 | "(5, False, False)", 2170 | "" 2171 | ], 2172 | "description": "x2m unlink all, don't use in create()", 2173 | "prefix": "oo_x2m/unlink_all" 2174 | }, 2175 | "x2m/update": { 2176 | "body": [ 2177 | "", 2178 | "(1, ${1:id}, ${2:{values}})", 2179 | "" 2180 | ], 2181 | "description": "x2m update, don't use in create()", 2182 | "prefix": "oo_x2m/update" 2183 | } 2184 | } -------------------------------------------------------------------------------- /snippets/xml.json: -------------------------------------------------------------------------------- 1 | { 2 | "action/binding": { 3 | "body": [ 4 | "", 5 | "", 6 | "" 7 | ], 8 | "description": "Fully formated time relative to now", 9 | "prefix": "oo_action/binding" 10 | }, 11 | "arch/form": { 12 | "body": [ 13 | "", 14 | "
", 15 | " ", 16 | "
", 17 | "
", 20 | " ${0}", 21 | "
", 22 | "
", 23 | "" 24 | ], 25 | "description": "Common form tag to be added inside a ir.ui.view", 26 | "prefix": "oo_arch/form" 27 | }, 28 | "arch/graph": { 29 | "body": [ 30 | "", 31 | "", 32 | " ", 33 | " ", 34 | " ", 35 | "${0}", 36 | "" 37 | ], 38 | "description": "Common graph tag to be added inside a ir.ui.view", 39 | "prefix": "oo_arch/graph" 40 | }, 41 | "arch/pivot": { 42 | "body": [ 43 | "", 44 | "", 45 | " ", 46 | " ", 47 | " ", 48 | "${0}", 49 | "" 50 | ], 51 | "description": "Common graph tag to be added inside a ir.ui.view", 52 | "prefix": "oo_arch/pivot" 53 | }, 54 | "arch/search": { 55 | "body": [ 56 | "", 57 | "", 58 | " ${0}", 59 | "", 60 | "" 61 | ], 62 | "description": "Common search tag to be added inside a ir.ui.view", 63 | "prefix": "oo_arch/search" 64 | }, 65 | "arch/tree": { 66 | "body": [ 67 | "", 68 | "", 69 | " ${0}", 70 | "", 71 | "" 72 | ], 73 | "description": "Common tree tag to be added inside a ir.ui.view", 74 | "prefix": "oo_arch/tree" 75 | }, 76 | "attribute": { 77 | "body": [ 78 | "", 79 | "${2:ATTRIBUTE_VALUE}${0}", 80 | "" 81 | ], 82 | "description": "", 83 | "prefix": "oo_attribute" 84 | }, 85 | "attribute/domain": { 86 | "body": [ 87 | "", 88 | "[(${1:FIELD},${2:OP},${3:VALUE})]${0}", 89 | "" 90 | ], 91 | "description": "", 92 | "prefix": "oo_attribute/domain" 93 | }, 94 | "attribute/domain1": { 95 | "body": [ 96 | "", 97 | "[(${1:FIELD},${2:OP},${3:VALUE})]${0}", 98 | "" 99 | ], 100 | "description": "", 101 | "prefix": "oo_attribute/domain" 102 | }, 103 | "attribute/invisible": { 104 | "body": [ 105 | "", 106 | "${1:True}${0}", 107 | "" 108 | ], 109 | "description": "", 110 | "prefix": "oo_attribute/invisible" 111 | }, 112 | "attribute/invisible1": { 113 | "body": [ 114 | "", 115 | "${1:True}${0}", 116 | "" 117 | ], 118 | "description": "", 119 | "prefix": "oo_attribute/invisible" 120 | }, 121 | "attribute/options": { 122 | "body": [ 123 | "", 124 | "{${1:KEY}:${2:VALUE}}${0}", 125 | "" 126 | ], 127 | "description": "", 128 | "prefix": "oo_attribute/options" 129 | }, 130 | "attribute/options1": { 131 | "body": [ 132 | "", 133 | "{${1:KEY}:${2:VALUE}}${0}", 134 | "" 135 | ], 136 | "description": "", 137 | "prefix": "oo_attribute/options" 138 | }, 139 | "attribute/readonly": { 140 | "body": [ 141 | "", 142 | "${1:True}${0}", 143 | "" 144 | ], 145 | "description": "", 146 | "prefix": "oo_attribute/readonly" 147 | }, 148 | "attribute/readonly1": { 149 | "body": [ 150 | "", 151 | "${1:True}${0}", 152 | "" 153 | ], 154 | "description": "", 155 | "prefix": "oo_attribute/readonly" 156 | }, 157 | "attribute/required": { 158 | "body": [ 159 | "", 160 | "${1:True}${0}", 161 | "" 162 | ], 163 | "description": "", 164 | "prefix": "oo_attribute/required" 165 | }, 166 | "attribute/required1": { 167 | "body": [ 168 | "", 169 | "${1:True}${0}", 170 | "" 171 | ], 172 | "description": "", 173 | "prefix": "oo_attribute/required" 174 | }, 175 | "attribute1": { 176 | "body": [ 177 | "", 178 | "${2:ATTRIBUTE_VALUE}${0}", 179 | "" 180 | ], 181 | "description": "", 182 | "prefix": "oo_attribute" 183 | }, 184 | "attrs": { 185 | "body": [ 186 | "", 187 | "attrs=\"{ ${0} }\"", 188 | "" 189 | ], 190 | "description": "field attr attrs", 191 | "prefix": "oo_attrs" 192 | }, 193 | "attrs/invisible": { 194 | "body": [ 195 | "", 196 | "'column_invisible': [('state','not in',('draft'))] ${0}", 197 | "" 198 | ], 199 | "description": "field attr attrs column_invisible", 200 | "prefix": "oo_attrs/invisible" 201 | }, 202 | "attrs/invisible1": { 203 | "body": [ 204 | "", 205 | "'invisible': [('state','not in',('draft'))] ${0}", 206 | "" 207 | ], 208 | "description": "field attr attrs invisible", 209 | "prefix": "oo_attrs/invisible" 210 | }, 211 | "attrs/readonly": { 212 | "body": [ 213 | "", 214 | "'readonly': [('state','not in',('draft'))] ${0}", 215 | "" 216 | ], 217 | "description": "field attr attrs readonly", 218 | "prefix": "oo_attrs/readonly" 219 | }, 220 | "attrs/required": { 221 | "body": [ 222 | "", 223 | "'required': [('state','not in',('draft'))] ${0}", 224 | "" 225 | ], 226 | "description": "field attr attrs required", 227 | "prefix": "oo_attrs/required" 228 | }, 229 | "button/cancel": { 230 | "body": [ 231 | "", 232 | "