~openerp-groupes/hrself-addons/employee-security

« back to all changes in this revision

Viewing changes to hrself/hrself_facade.py

  • Committer: Olivier Ligot
  • Date: 2010-12-28 08:23:51 UTC
  • Revision ID: olivier.ligot@groupes.be-20101228082351-ledsm9s3k48v8q3v
[ADD] HRSelf API documentation

TODO: replace @ with : in *.py doc

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
    def create_hrself_code_list(self,cr,uid,values):
48
48
        """Create a HRSelf code list.
49
 
        @param values: Values
50
 
        @type values: dict
51
 
        @return: identifier of created HRSelf code list
52
 
        @rtype: integer"""
 
49
 
 
50
        :param values: Values
 
51
        :type values: dict
 
52
        :return: identifier of created HRSelf code list
 
53
        :rtype: integer"""
53
54
        return self._create_update_object_translation(cr, uid, None, 'hrself.code.list', values)
54
55
 
55
56
    def update_hrself_code_list(self,cr,uid,id,values):
56
57
        """Update a HRSelf code list.
57
 
        @param id: HRSelf code list identifier
58
 
        @type id: integer
59
 
        @param values: Values
60
 
        @type values: dict
61
 
        @return: True on sucess, False on failure
62
 
        @rtype: boolean"""
 
58
 
 
59
        :param id: HRSelf code list identifier
 
60
        :type id: integer
 
61
        :param values: Values
 
62
        :type values: dict
 
63
        :return: True on sucess, False on failure
 
64
        :rtype: boolean"""
63
65
        result = self.pool.get('hrself.code.list').write(cr,uid,id,values)
64
66
        logger.info('hrself.code.list %d updated' % id)
65
67
        return result
66
68
 
67
69
    def read_hrself_code_list(self,cr,uid,identifier,value):
68
70
        """Read a HRSelf code list identified in Groupe S by (identifier, value).
69
 
        @param identifier: Groupe S code list identifier
70
 
        @type identifier: integer
71
 
        @param identifier: Groupe S code list value
72
 
        @type identifier: integer
73
 
        @return: Field values if HRSelf code list exists, False otherwise
74
 
        @rtype: dict or boolean"""
 
71
 
 
72
        :param identifier: Groupe S code list identifier
 
73
        :type identifier: integer
 
74
        :param identifier: Groupe S code list value
 
75
        :type identifier: integer
 
76
        :return: Field values if HRSelf code list exists, False otherwise
 
77
        :rtype: dict or boolean"""
75
78
        code_list_object = self.pool.get('hrself.code.list')
76
79
        code_list_ids = code_list_object.search(cr,uid,[('groupes_id', '=', identifier), ('groupes_num_value', '=', value)])
77
80
        if code_list_ids:
83
86
 
84
87
    def create_hrself_prestation_code(self, cr, uid, values):
85
88
        """Create a HRSelf prestation code.
86
 
        @param values: Values
87
 
        @type values: dict
88
 
        @return: identifier of created HRSelf prestation code
89
 
        @rtype: integer"""
 
89
 
 
90
        :param values: Values
 
91
        :type values: dict
 
92
        :return: identifier of created HRSelf prestation code
 
93
        :rtype: integer"""
90
94
        return self._create_update_object_translation(cr, uid, None, 'hrself.prestation.code', values)
91
95
 
92
96
    def update_hrself_prestation_code(self, cr, uid, id, values):
93
97
        """Update a HRSelf prestation code.
94
 
        @param id: HRSelf prestation code identifier
95
 
        @type id: integer
96
 
        @param values: Values
97
 
        @type values: dict
98
 
        @return: True on sucess, False on failure
99
 
        @rtype: boolean"""
 
98
 
 
99
        :param id: HRSelf prestation code identifier
 
100
        :type id: integer
 
101
        :param values: Values
 
102
        :type values: dict
 
103
        :return: True on sucess, False on failure
 
104
        :rtype: boolean"""
100
105
        return self._create_update_object_translation(cr, uid, id, 'hrself.prestation.code', values)
101
106
 
102
107
    def read_hrself_prestation_code(self, cr, uid, employer_id, mnemonic):
103
108
        """Read a HRSelf prestation code identified in Groupe S by (employer_id, mnemonic).
104
 
        @param employer_id: Groupe S employer identifier
105
 
        @type employer_id: integer
106
 
        @param mnemonic: Groupe S mnemonic
107
 
        @type mnemonic: str
108
 
        @return: Field values if HRSelf prestation code exists, False otherwise
109
 
        @rtype: dict or boolean"""
 
109
 
 
110
        :param employer_id: Groupe S employer identifier
 
111
        :type employer_id: integer
 
112
        :param mnemonic: Groupe S mnemonic
 
113
        :type mnemonic: str
 
114
        :return: Field values if HRSelf prestation code exists, False otherwise
 
115
        :rtype: dict or boolean"""
110
116
        if employer_id:
111
117
            employer_object = self.pool.get('hrself.employer')
112
118
            employer_ids = employer_object.search(cr, uid, [('groupes_id', '=', employer_id)])
127
133
 
128
134
    def create_hrself_counter_type(self, cr, uid, values):
129
135
        """Create a HRSelf counter type.
130
 
        @param values: Values
131
 
        @type values: dict
132
 
        @return: identifier of created HRSelf counter type
133
 
        @rtype: integer"""
 
136
 
 
137
        :param values: Values
 
138
        :type values: dict
 
139
        :return: identifier of created HRSelf counter type
 
140
        :rtype: integer"""
134
141
        return self._create_update_object_translation(cr, uid, None, 'hrself.counter.type', self._hrself_counter_type_values(values))
135
142
 
136
143
    def update_hrself_counter_type(self, cr, uid, id, values):
137
144
        """Update a HRSelf counter type.
138
 
        @param id: HRSelf counter type identifier
139
 
        @type id: integer
140
 
        @param values: Values
141
 
        @type values: dict
142
 
        @return: True on sucess, False on failure
143
 
        @rtype: boolean"""
 
145
 
 
146
        :param id: HRSelf counter type identifier
 
147
        :type id: integer
 
148
        :param values: Values
 
149
        :type values: dict
 
150
        :return: True on sucess, False on failure
 
151
        :rtype: boolean"""
144
152
        return self._create_update_object_translation(cr, uid, id, 'hrself.counter.type', self._hrself_counter_type_values(values))
145
153
 
146
154
    def _hrself_counter_type_values(self, values):
147
155
        """OpenERP counter type values corresponding to Groupe S values.
148
 
        @param values: Groupe S values
149
 
        @type values: dict
150
 
        @return: OpenERP values
151
 
        @rtype: dict"""
 
156
 
 
157
        :param values: Groupe S values
 
158
        :type values: dict
 
159
        :return: OpenERP values
 
160
        :rtype: dict"""
152
161
        result = dict(values)
153
162
        if values.get('init_date'):
154
163
            result['init_date'] = hrself_datetime.to_date(values['init_date'].value, hrself_datetime.XML_RPC_DATETIME_FORMAT)
156
165
 
157
166
    def read_hrself_counter_type(self, cr, uid, employer_id, mnemonic):
158
167
        """Read a HRSelf counter type identified in Groupe S by (employer_id, mnemonic).
159
 
        @param employer_id: Groupe S employer identifier
160
 
        @type employer_id: integer
161
 
        @param mnemonic: Groupe S mnemonic
162
 
        @type mnemonic: str
163
 
        @return: Field values if HRSelf counter type exists, False otherwise
164
 
        @rtype: dict or boolean"""
 
168
        
 
169
        :param employer_id: Groupe S employer identifier
 
170
        :type employer_id: integer
 
171
        :param mnemonic: Groupe S mnemonic
 
172
        :type mnemonic: str
 
173
        :return: Field values if HRSelf counter type exists, False otherwise
 
174
        :rtype: dict or boolean"""
165
175
        employer_object = self.pool.get('hrself.employer')
166
176
        employer_ids = employer_object.search(cr, uid, [('groupes_id', '=', employer_id)])
167
177
        counter_type_object = self.pool.get('hrself.counter.type')
179
189
 
180
190
    def create_hrself_universe(self,cr,uid,values):
181
191
        """Create a HRSelf universe.
182
 
        @param values: Values
183
 
        @type values: dict
184
 
        @return: identifier of created HRSelf universe
185
 
        @rtype: integer"""
 
192
 
 
193
        :param values: Values
 
194
        :type values: dict
 
195
        :return: identifier of created HRSelf universe
 
196
        :rtype: integer"""
186
197
        universe_object = self.pool.get('hrself.universe')
187
198
        universe_id = universe_object.create(cr,uid,values)
188
199
        logger.info('hrself.universe %d created' % universe_id)
208
219
 
209
220
    def update_hrself_universe(self,cr,uid,id,values):
210
221
        """Update a HRSelf universe.
211
 
        @param id: HRSelf universe identifier
212
 
        @type id: integer
213
 
        @param values: Values
214
 
        @type values: dict
215
 
        @return: True on sucess, False on failure
216
 
        @rtype: boolean"""
 
222
 
 
223
        :param id: HRSelf universe identifier
 
224
        :type id: integer
 
225
        :param values: Values
 
226
        :type values: dict
 
227
        :return: True on sucess, False on failure
 
228
        :rtype: boolean"""
217
229
        result = self.pool.get('hrself.universe').write(cr,uid,id,values)
218
230
        logger.info('hrself.universe %d updated' % id)
219
231
        return result
220
232
 
221
233
    def read_hrself_universe(self,cr,uid,identifier):
222
234
        """Read a HRSelf universe identified in Groupe S by identifier.
223
 
        @param identifier: Groupe S universe identifier
224
 
        @type identifier: integer
225
 
        @return: Field values if HRSelf universe exists, False otherwise
226
 
        @rtype: dict or boolean"""
 
235
 
 
236
        :param identifier: Groupe S universe identifier
 
237
        :type identifier: integer
 
238
        :return: Field values if HRSelf universe exists, False otherwise
 
239
        :rtype: dict or boolean"""
227
240
        universe_object = self.pool.get('hrself.universe')
228
241
        universe_ids = universe_object.search(cr,uid,[('groupes_id', '=', identifier)])
229
242
        if universe_ids:
233
246
 
234
247
    def create_hrself_employer(self,cr,uid,values):
235
248
        """Create a HRSelf employer.
236
 
        @param values: Values
237
 
        @type values: dict
238
 
        @return: identifier of created HRSelf employer
239
 
        @rtype: integer"""
 
249
 
 
250
        :param values: Values
 
251
        :type values: dict
 
252
        :return: identifier of created HRSelf employer
 
253
        :rtype: integer"""
240
254
        employer_id = self.pool.get('hrself.employer').create(cr,uid,values)
241
255
        logger.info('hrself.employer %d created' % employer_id)
242
256
        return employer_id
243
257
 
244
258
    def update_hrself_employer(self,cr,uid,id,values):
245
259
        """Update a HRSelf employer.
246
 
        @param id: HRSelf employer identifier
247
 
        @type id: integer
248
 
        @param values: Values
249
 
        @type values: dict
250
 
        @return: True on sucess, False on failure
251
 
        @rtype: boolean"""
 
260
 
 
261
        :param id: HRSelf employer identifier
 
262
        :type id: integer
 
263
        :param values: Values
 
264
        :type values: dict
 
265
        :return: True on sucess, False on failure
 
266
        :rtype: boolean"""
252
267
        pass
253
268
 
254
269
    def read_hrself_employer(self,cr,uid,universe_identifier,employer_identifier):
255
270
        """Read a HRSelf employer identified in Groupe S by (universe_identifier, employer_identifier).
256
 
        @param universe_identifier: Groupe S universe identifier
257
 
        @type universe_identifier: integer
258
 
        @param employer_identifier: Groupe S employer identifier
259
 
        @type person_identifier: integer
260
 
        @return: Field values if HRSelf employer exists, False otherwise
261
 
        @rtype: dict or boolean"""
 
271
 
 
272
        :param universe_identifier: Groupe S universe identifier
 
273
        :type universe_identifier: integer
 
274
        :param employer_identifier: Groupe S employer identifier
 
275
        :type person_identifier: integer
 
276
        :return: Field values if HRSelf employer exists, False otherwise
 
277
        :rtype: dict or boolean"""
262
278
        universe_object = self.pool.get('hrself.universe')
263
279
        universe_ids = universe_object.search(cr,uid,[('groupes_id', '=', universe_identifier)])
264
280
        employer_object = self.pool.get('hrself.employer')
272
288
 
273
289
    def create_hrself_ccte(self,cr,uid,values):
274
290
        """Create a HRSelf CCTE.
275
 
        @param values: Values
276
 
        @type values: dict
277
 
        @return: identifier of created HRSelf CCTE
278
 
        @rtype: integer"""
 
291
 
 
292
        :param values: Values
 
293
        :type values: dict
 
294
        :return: identifier of created HRSelf CCTE
 
295
        :rtype: integer"""
279
296
        return self._create_update_object_translation(cr, uid, None, 'hrself.ccte', values)
280
297
 
281
298
    def update_hrself_ccte(self,cr,uid,id,values):
282
299
        """Update a HRSelf CCTE.
283
 
        @param id: HRSelf CCTE identifier
284
 
        @type id: integer
285
 
        @param values: Values
286
 
        @type values: dict
287
 
        @return: True on sucess, False on failure
288
 
        @rtype: boolean"""
 
300
 
 
301
        :param id: HRSelf CCTE identifier
 
302
        :type id: integer
 
303
        :param values: Values
 
304
        :type values: dict
 
305
        :return: True on sucess, False on failure
 
306
        :rtype: boolean"""
289
307
        pass
290
308
 
291
309
    def read_hrself_ccte(self,cr,uid,employer_identifier,ccte_identifier):
292
310
        """Read a HRSelf CCTE identified in Groupe S by (employer_identifier, ccte_identifier).
293
 
        @param employer_identifier: Groupe S employer identifier
294
 
        @type employer_identifier: integer
295
 
        @param ccte_identifier: Groupe S CCTE identifier
296
 
        @type ccte_identifier: str
297
 
        @return: Field values if HRSelf CCTE exists, False otherwise
298
 
        @rtype: dict or boolean"""
 
311
 
 
312
        :param employer_identifier: Groupe S employer identifier
 
313
        :type employer_identifier: integer
 
314
        :param ccte_identifier: Groupe S CCTE identifier
 
315
        :type ccte_identifier: str
 
316
        :return: Field values if HRSelf CCTE exists, False otherwise
 
317
        :rtype: dict or boolean"""
299
318
        employer_object = self.pool.get('hrself.employer')
300
319
        employer_ids = employer_object.search(cr,uid,[('groupes_id', '=', employer_identifier)])
301
320
        ccte_object = self.pool.get('hrself.ccte')
310
329
 
311
330
    def create_hrself_level(self, cr, uid, values):
312
331
        """Create a HRSelf level.
313
 
        @param values: Values
314
 
        @type values: dict
315
 
        @return: identifier of created HRSelf level
316
 
        @rtype: integer"""
 
332
 
 
333
        :param values: Values
 
334
        :type values: dict
 
335
        :return: identifier of created HRSelf level
 
336
        :rtype: integer"""
317
337
        return self._create_update_object_translation(cr, uid, None, 'hrself.level', values)
318
338
 
319
339
    def update_hrself_level(self, cr, uid, id, values):
320
340
        """Update a HRSelf level.
321
 
        @param id: HRSelf level identifier
322
 
        @type id: integer
323
 
        @param values: Values
324
 
        @type values: dict
325
 
        @return: True on sucess, False on failure
326
 
        @rtype: boolean"""
 
341
 
 
342
        :param id: HRSelf level identifier
 
343
        :type id: integer
 
344
        :param values: Values
 
345
        :type values: dict
 
346
        :return: True on sucess, False on failure
 
347
        :rtype: boolean"""
327
348
        return self._create_update_object_translation(cr, uid, id, 'hrself.level', values)
328
349
 
329
350
    def read_hrself_level(self,cr,uid,employer_identifier,level_code, level_value):
330
351
        """Read a HRSelf level identified in Groupe S by (employer_identifier, level_code, level_value).
331
 
        @param employer_identifier: Groupe S employer identifier
332
 
        @type employer_identifier: integer
333
 
        @param level_code: Groupe S level code
334
 
        @type level_code: integer
335
 
        @param level_value: Groupe S level value
336
 
        @type level_value: integer
337
 
        @return: Field values if HRSelf level exists, False otherwise
338
 
        @rtype: dict or boolean"""
 
352
 
 
353
        :param employer_identifier: Groupe S employer identifier
 
354
        :type employer_identifier: integer
 
355
        :param level_code: Groupe S level code
 
356
        :type level_code: integer
 
357
        :param level_value: Groupe S level value
 
358
        :type level_value: integer
 
359
        :return: Field values if HRSelf level exists, False otherwise
 
360
        :rtype: dict or boolean"""
339
361
        employer_object = self.pool.get('hrself.employer')
340
362
        employer_ids = employer_object.search(cr,uid,[('groupes_id', '=', employer_identifier)])
341
363
        level_object = self.pool.get('hrself.level')
350
372
 
351
373
    def create_hrself_person(self, cr, uid, values):
352
374
        """Create a HRSelf person.
353
 
        @param values: Values
354
 
        @type values: dict
355
 
        @return: identifier of created HRSelf person
356
 
        @rtype: integer"""
 
375
 
 
376
        :param values: Values
 
377
        :type values: dict
 
378
        :return: identifier of created HRSelf person
 
379
        :rtype: integer"""
357
380
        user_id = self._create_user(cr, uid, values)
358
381
        values['user_id'] = user_id
359
382
        employee_id = self._create_employee(cr, uid, self._hrself_person_values(cr, uid, values))
361
384
 
362
385
    def _create_user(self, cr, uid, values):
363
386
        """Create a user.
364
 
        @return: identifier of created user
365
 
        @rtype: integer"""
 
387
 
 
388
        :return: identifier of created user
 
389
        :rtype: integer"""
366
390
        user_object = self.pool.get('res.users')
367
391
        name = values['name']
368
392
        user_values = {
379
403
 
380
404
    def _create_employee(self, cr, uid, values):
381
405
        """Create an employee.
382
 
        @return: identifier of created employee
383
 
        @rtype: integer"""
 
406
 
 
407
        :return: identifier of created employee
 
408
        :rtype: integer"""
384
409
        employee_id = self.pool.get('hr.employee').create(cr, uid, values)
385
410
        logger.info('hr.employee %d created' % employee_id)
386
411
        return employee_id
387
412
 
388
413
    def update_hrself_person(self, cr, uid, id, values):
389
414
        """Update a HRSelf person.
390
 
        @param id: HRSelf person identifier
391
 
        @type id: integer
392
 
        @param values: Values
393
 
        @type values: dict
394
 
        @return: True on sucess, False on failure
395
 
        @rtype: boolean"""
 
415
 
 
416
        :param id: HRSelf person identifier
 
417
        :type id: integer
 
418
        :param values: Values
 
419
        :type values: dict
 
420
        :return: True on sucess, False on failure
 
421
        :rtype: boolean"""
396
422
        user_values = {'active': values['active']}
397
423
        if 'context_lang' in values:
398
424
            user_values['context_lang'] = values.pop('context_lang')
405
431
 
406
432
    def _hrself_person_values(self, cr, uid, values):
407
433
        """OpenERP person values corresponding to Groupe S values.
408
 
        @param values: Groupe S values
409
 
        @type values: dict
410
 
        @return: OpenERP values
411
 
        @rtype: dict"""
 
434
 
 
435
        :param values: Groupe S values
 
436
        :type values: dict
 
437
        :return: OpenERP values
 
438
        :rtype: dict"""
412
439
        result = dict(values)
413
440
        if 'country_id' in values:
414
441
            country_ids = self.pool.get('res.country').search(cr, uid, [('code', '=', values['country_id'])])
449
476
 
450
477
    def search_hrself_person(self, cr, uid, universe_identifier, person_identifier):
451
478
        """Search a HRSelf person identified in Groupe S by (universe_identifier, person_identifier).
452
 
        @param universe_identifier: Groupe S universe identifier
453
 
        @type universe_identifier: integer
454
 
        @param person_identifier: Groupe S person identifier
455
 
        @type person_identifier: integer
456
 
        @return: OpenERP Identifier if the person exists, False otherwise
457
 
        @rtype: integer or boolean"""
 
479
 
 
480
        :param universe_identifier: Groupe S universe identifier
 
481
        :type universe_identifier: integer
 
482
        :param person_identifier: Groupe S person identifier
 
483
        :type person_identifier: integer
 
484
        :return: OpenERP Identifier if the person exists, False otherwise
 
485
        :rtype: integer or boolean"""
458
486
        universe_ids = self.pool.get('hrself.universe').search(cr, uid, [('groupes_id', '=', universe_identifier)])
459
487
        employee_ids = self.pool.get('hr.employee').search(cr, uid, [('universe_id', 'in', universe_ids), ('groupes_id', '=', person_identifier)])
460
488
        if employee_ids:
464
492
 
465
493
    def read_hrself_person(self, cr, uid, id):
466
494
        """Read a HRSelf person identified by id.
467
 
        @precondition: the person identified by id exists
468
 
        @return: Field values of the HRSelf person
469
 
        @rtype: dict"""
 
495
 
 
496
        :precondition: the person identified by id exists
 
497
        :return: Field values of the HRSelf person
 
498
        :rtype: dict"""
470
499
        result = self.pool.get('hr.employee').read(cr, uid, id, [
471
500
            'universe_id', 'user_id', 'marital', 'country_id', 'birthday', 'groupes_id', 
472
501
            'name', 'first_name', 'gender', 'active', 'work_email', 'home_email',
489
518
 
490
519
    def create_hrself_activity_context(self, cr, uid, values):
491
520
        """Create a HRSelf activity context if it doesn't exists.
492
 
        @param values: Values
493
 
        @type values: dict
494
 
        @return: identifier of HRSelf activity context (created or existing)
495
 
        @rtype: integer"""
 
521
 
 
522
        :param values: Values
 
523
        :type values: dict
 
524
        :return: identifier of HRSelf activity context (created or existing)
 
525
        :rtype: integer"""
496
526
        universe_id = self.pool.get('hrself.universe').search(cr,uid,[('groupes_id', '=', values['universe_id'])])[0]
497
527
        employer_id = self.pool.get('hrself.employer').search(cr, uid, [('universe_id', '=', universe_id), ('groupes_id', '=', values['employer_id'])])[0]
498
528
        ccte_id = self.pool.get('hrself.ccte').search(cr, uid, [('employer_id', '=', employer_id), ('groupes_id', '=', values['ccte_id'])])[0]
533
563
 
534
564
    def read_hrself_activity_context(self, cr, uid, values):
535
565
        """Read a HRSelf activity context based on values.
536
 
        @param values: values
537
 
        @type values: dict
538
 
        @return: Field values if HRSelf activity context exists, False otherwise
539
 
        @rtype: dict or boolean"""
 
566
 
 
567
        :param values: values
 
568
        :type values: dict
 
569
        :return: Field values if HRSelf activity context exists, False otherwise
 
570
        :rtype: dict or boolean"""
540
571
        universe_object = self.pool.get('hrself.universe')
541
572
        universe_ids = universe_object.search(cr,uid,[('groupes_id', '=', values['universe_id'])])
542
573
        employer_object = self.pool.get('hrself.employer')
572
603
 
573
604
    def _create_update_object_translation(self, cr, uid, id, model_name, values):
574
605
        """Create or update a HRSelf object that has a translatable field.
575
 
        @param id: 
 
606
 
 
607
        :param id: 
576
608
            - create: identifier of HRSelf object
577
609
            - update: None
578
 
        @type id: int
579
 
        @param model_name: the model name
580
 
        @type model_name: str
581
 
        @param values: Values
582
 
        @type values: dict
583
 
        @return: 
 
610
        :type id: int
 
611
        :param model_name: the model name
 
612
        :type model_name: str
 
613
        :param values: Values
 
614
        :type values: dict
 
615
        :return: 
584
616
            - create: identifier of created HRSelf object
585
617
            - update: True on success, False on failure
586
 
        @rtype: 
 
618
        :rtype: 
587
619
            - create: integer
588
620
            - update: bool"""
589
621
        names = values.pop('name')
602
634
 
603
635
    def _create_update_translations(self, cr, uid, id, model_name, source_name, names):
604
636
        """Create or update the translations associated to a model.
605
 
        @param id: the model identifier
606
 
        @type id: int
607
 
        @param model_name: the model name
608
 
        @type model_name: str
609
 
        @param source_name: the source name for the translation
610
 
        @type source_name: str
611
 
        @param names: the translations
612
 
        @type names: dict where the keys are the language and the value the translation in that language"""
 
637
 
 
638
        :param id: the model identifier
 
639
        :type id: int
 
640
        :param model_name: the model name
 
641
        :type model_name: str
 
642
        :param source_name: the source name for the translation
 
643
        :type source_name: str
 
644
        :param names: the translations
 
645
        :type names: dict where the keys are the language and the value the translation in that language"""
613
646
        translation_object = self.pool.get('ir.translation')
614
647
        for (key, value) in names.iteritems():
615
648
            if value:
627
660
 
628
661
    def _read_translations(self, cr, uid, ids, model_name):
629
662
        """Read the translations associated to a model.
630
 
        @param ids: the model identifiers
631
 
        @type ids: list of integer
632
 
        @param model_name: the model name
633
 
        @type model_name: str
634
 
        @return: the translations
635
 
        @rtype: dict where the keys are the language and the value the translation in that language"""
 
663
 
 
664
        :param ids: the model identifiers
 
665
        :type ids: list of integer
 
666
        :param model_name: the model name
 
667
        :type model_name: str
 
668
        :return: the translations
 
669
        :rtype: dict where the keys are the language and the value the translation in that language"""
636
670
        translations = {}
637
671
        translation_object = self.pool.get('ir.translation')
638
672
        translation_ids = translation_object.search(cr,uid,[('name', '=', translation_object.name_for_model_type(model_name, 'name')),('type', '=', 'model'),('res_id', 'in', ids)])