@@ -16,8 +16,8 @@ snippet start
16
16
# -*- coding: utf-8 -*-
17
17
###############################################################################
18
18
#
19
- # Module for OpenERP
20
- # Copyright (C) 2013 Akretion (http://www.akretion.com).
19
+ # Module for OpenERP
20
+ # Copyright (C) 2014 Akretion (http://www.akretion.com).
21
21
# @author Sébastien BEAU <sebastien.beau@akretion.com>
22
22
#
23
23
# This program is free software: you can redistribute it and/or modify
@@ -171,11 +171,17 @@ snippet ondelete OnDelete Set Null
171
171
ondelete='set null', ${1}
172
172
snippet store
173
173
store={
174
- '${1: Model } ': (${2: get_model_ids_to_update } , [${3: fields } ], ${4: Priority } ),
174
+ '${1: Model } ': (
175
+ ${2: get_model_ids_to_update } ,
176
+ [${3: fields } ],
177
+ ${4: Priority } ),
175
178
},
176
179
snippet store lambda
177
180
store={
178
- '${1: Model } ': (lambda self, cr, uid, ids, c={}: ids, [${2: fields } ], ${3: Priority } ),
181
+ '${1: Model } ': (
182
+ lambda self, cr, uid, ids, c={}: ids,
183
+ [${2: fields } ],
184
+ ${3: Priority } ),
179
185
},
180
186
181
187
#
@@ -194,38 +200,26 @@ snippet func def search
194
200
return res
195
201
snippet func def read
196
202
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
197
- """
198
- #TODO make doc string
199
- ${2: Comment this }
200
- """
201
203
if context is None:
202
204
context = {}
203
- res = super( ${1: ClassName } , self).read(cr, uid, ids, fields, context=context)
204
- #TODO : process on result
205
+ ${1}
206
+ res = super( ${2 : ClassName } , self).read(cr, uid, ids, fields, context=context)
205
207
${3}
206
208
return res
207
209
snippet func def create
208
- def create(self, cr, uid, values, context=None):
209
- """
210
- #TODO make doc string
211
- ${2: Comment this }
212
- """
210
+ def create(self, cr, uid, vals, context=None):
213
211
if context is None:
214
212
context = {}
215
- #TODO : process on result
216
- id = super(${1 : ClassName } , self).create(cr, uid, values , context=context)
217
- ${3 }
218
- return id
213
+ ${1}
214
+ ${3 : record } _id = super(${2 : ClassName } , self).create(cr, uid, vals , context=context)
215
+ ${4 }
216
+ return $3 _id
219
217
snippet func def write
220
218
def write(self, cr, uid, ids, values, context=None):
221
- """
222
- #TODO make doc string
223
- ${2: Comment this }
224
- """
225
219
if context is None:
226
220
context = {}
227
- #TODO : process on result
228
- res = super(${1 : ClassName } , self).write(cr, uid, ids, values, context=context)
221
+ ${1}
222
+ res = super(${2 : ClassName } , self).write(cr, uid, ids, values, context=context)
229
223
${3}
230
224
return res
231
225
snippet func def unlink
@@ -462,10 +456,10 @@ snippet . copy
462
456
.copy(cr, uid, ${1: id } , ${2: default } , context=${3: context } )${4}
463
457
# ##
464
458
# # define exception
465
- snippet except raise osv.except_osv (title, message)
466
- raise osv.except_osv(_(' ${1 : Error } '), _(' ${2 : Message } '))
467
- snippet except raise wizard.except_wizard(title, message)
468
- raise wizard.except_wizard(_(' ${1 : Error } '), _('${2: Message } '))
459
+ snippet raise raise orm.except_orm (title, message)
460
+ raise orm.except_orm(
461
+ _(' ${1 : Error } '),
462
+ _('${2: Message } '))
469
463
# ##
470
464
# # Cursor
471
465
snippet cr cr.execute()
@@ -519,6 +513,10 @@ snippet log Error
519
513
logger.error('${1} ')
520
514
snippet ctx
521
515
ctx = context.copy()
516
+ snippet ref
517
+ __, ${1: erp_id } = self.pool['ir.model.data'].get_object_reference(
518
+ cr, uid, '${2: module } ', '${3: xml_id } ')
519
+
522
520
#
523
521
# Other python declaration
524
522
#
0 commit comments