~andorrax/school-base-openerp-module/xavi

« back to all changes in this revision

Viewing changes to school_attendance/wizards/school_seance_annotations_by_student.py

  • Committer: Pere Erro
  • Date: 2012-09-17 17:11:00 UTC
  • Revision ID: pereerro@terra.es-20120917171100-0f73ayq59ggp5rq3
[REF] Perms changed to establish defaults perms for teacher
[IMP] New wizard to modify annotations and their state change.
[FIX] Some bugs fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
prefix_contact = "_contact_"
38
38
CTX_WIZ_ID = 'ssabt_id'
39
39
prefix2 = "cont_"
 
40
UID_ADMIN = 1
40
41
 
41
42
field_template = prefix + prefix_seance + "%s" + prefix_contact + "%s"
42
43
 
362
363
                        if v and lu in v and (not ov or lu not in ov):
363
364
                            anno_types.append( (justified_aux.anno_subs.id, contact_id) )
364
365
        for seance in self.pool.get('school.seance').browse(cr, uid, seances.keys()):
 
366
            informers = self.pool.get('res.partner').search(cr, UID_ADMIN, [('user_id','=',uid)])
 
367
            teachers = [x.teacher_id.partner_id.id for x in seance.teachers if x.teacher_id.teacher_user_id.id==uid]            
365
368
            for anno_type_id, contact_id in seances[seance.id]:
366
 
                self.pool.get('contact.annotation').create(cr, uid, {
 
369
                self.pool.get('contact.annotation').create(cr, UID_ADMIN, {
367
370
                        'contact_id' : contact_id,
368
371
                        'anno_type' : anno_type_id,
369
372
                        'valid_from' : seance.date,
370
373
                        'valid_to' : seance.date_to,
 
374
                        'informer' : teachers and teachers[0] or informers and informers[0] or False,                        
371
375
                    })
372
376
        for lid in ids:
373
377
            del self.wiz_datas[lid]