~school-dev-team/school-base-openerp-module/school-openerp-v2.0

« back to all changes in this revision

Viewing changes to contact_annotation/wizards/wizard_send_communications.py

  • Committer: Pere Erro
  • Date: 2012-07-27 17:15:53 UTC
  • Revision ID: pereerro@terra.es-20120727171553-4wy0vne3h90zz3sc
[IMP] 6.1 Compatibility
[IMP] New wizard to classe annotations
[FIX] No reported bug fixed
[IMP] Basic DIA diagram added for documentation purposes

Show diffs side-by-side

added added

removed removed

Lines of Context:
392
392
                        message = merge_message(self, cr, uid, (comm.sms_text or u''), comm, comm.partner_id)
393
393
                        gateway.send_message(cr, uid, wizard.sets_id.gateway.id, to, normal_unicode(message))
394
394
                        
395
 
                        # Add a partner event
396
 
                        c_id = self.pool.get('res.partner.canal').search(cr ,uid, [('name','ilike','SMS'),('active','=',True)])
397
 
                        c_id = c_id and c_id[0] or False
398
395
                        
399
396
                        self.pool.get('res.partner.event').create(cr, uid,
400
397
                                {'name': _('SMS sent through communication states wizard'),
402
399
                                 'contact_id' : comm.contact_id.id,
403
400
                                 'description': u'' + _('To: ') + to +
404
401
                                                _('\n\nText:\n') + normal_unicode(message),
405
 
                                 'document': '',
406
 
                                 'canal_id': c_id,
407
 
                                 'user_id': uid, })
 
402
                                 'document': '',})
408
403
                    
409
404
                if comm.to_send and comm.type == 'email':
410
405
                    communications_smtpserver_id = self.pool.get('email.smtpclient').search(cr, uid, [('type','=','communications'),('state','=','confirm'),('active','=',True)], context=False)
441
436
                        raise osv.except_osv(_('Error sending email'), _('Please check the Server Configuration!'))
442
437
 
443
438
                    # Add a partner event
444
 
                    c_id = self.pool.get('res.partner.canal').search(cr ,uid, [('name','ilike','EMAIL'),('active','=',True)])
445
439
                    c_id = c_id and c_id[0] or False
446
440
                    self.pool.get('res.partner.event').create(cr, uid,
447
441
                            {'name': _('Email sent through communication states wizard'),
451
445
                                            _('\n\nSubject: ') + normal_unicode(comm.subject) +
452
446
                                            _('\n\nText:\n') + normal_unicode(comm.text),
453
447
                             'document': '',
454
 
                             'canal_id': c_id,
455
448
                             'user_id': uid, })
456
449
                elif comm.to_send:
457
450
                    pdf = self._get_attachment(cr, uid, comm, context = context)                    
472
465
                                'res_model': 'crm.postmail',
473
466
                                'res_id': postmail_id,
474
467
                            }, context = context)
475
 
                    c_id = self.pool.get('res.partner.canal').search(cr ,uid, [('name','ilike','EMAIL'),('active','=',True)])
476
 
                    c_id = c_id and c_id[0] or False
477
468
                    self.pool.get('res.partner.event').create(cr, uid,
478
469
                            {'name': _('Post Mail sent through communication states wizard'),
479
470
                                     'partner_id': comm.partner_id.id,
482
473
                                            _('\n\nSubject: ') + normal_unicode(comm.subject)  +
483
474
                                            _('\n\nText:\n') + normal_unicode(comm.text),
484
475
                             'document': '',
485
 
                             'canal_id': c_id,
486
476
                             'user_id': uid, })
487
477
                else:
488
478
                    for report in wizard.sets_id.report_ids:
489
479
                        pdf = getattr(self,report.method)(cr, uid, comm, context = context)
490
480
                        myzip.writestr("report_%000d.pdf" % c, pdf);c+=1                        
491
481
                        
492
 
                    c_id = self.pool.get('res.partner.canal').search(cr ,uid, [('name','ilike','EMAIL'),('active','=',True)])
493
 
                    c_id = c_id and c_id[0] or False
494
482
                    self.pool.get('res.partner.event').create(cr, uid,
495
483
                            {'name': _('A intend of send through communication states wizard'),
496
484
                                     'partner_id': comm.partner_id.id,
498
486
                             'description': u'' + _('\n\nSubject: ') + normal_unicode(comm.subject)  +
499
487
                                            _('\n\nText:\n') + normal_unicode(comm.text),
500
488
                             'document': '',
501
 
                             'canal_id': c_id,
502
489
                             'user_id': uid, })
503
490
            myzip.close()
504
491
            self.write(cr, uid, [wizard.id], {'file': base64.encodestring(zipfile0.getvalue()) })