-
Notifications
You must be signed in to change notification settings - Fork 6
/
registro_activistas.py
executable file
·97 lines (87 loc) · 4.63 KB
/
registro_activistas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# Generated by the Odoo plugin for Dia !
from openerp import api, fields, models
class TelefonoActivista(models.Model):
"""Telefono del Activista"""
_name = 'telefonoactivista'
_rec_name = 'telefono'
telefono = fields.Char('Teléfono',size=12,required=True, help='Número de telefono del Activista')
activista_id = fields.Many2one('activista','Activista', help='Relacion entre el numero de telefono y el activista')
class Activista(models.Model):
"""Registro de Activista de Bachaco-ve"""
_name = 'activista'
#_rec_name = 'nombres'
nombres = fields.Char(size=30,required=True, help='Nombre del Activista')
apellidos = fields.Char(size=30,required=True, help='Apellidos del Activista')
aka = fields.Char('A.K.A.',size=30,required=True, help='Apellidos del Activista')
cedula = fields.Char('Cédula',size=8,required=True, help='Cédula del Activista')
telefono_ids = fields.One2many('telefonoactivista','activista_id','Teléfonos',required=True, help='Telefono(s) del Activista')
correo = fields.Char('Correo Electrónico',size=30,required=True, help='Correo Electrónico del Activista')
dom_estado_id = fields.Many2one('estado','Estado', help='Estado de Domicilio del Asistente')
dom_municipio_id = fields.Many2one('municipio','Municipio', help='Municipio de Domicilio del Asistente')
dom_parroquia_id = fields.Many2one('parroquia','Parroquia', help='Parroquia de Domicilio del Asistente')
#proyectos_ids = fields.One2many('proyectostrabajados','activista_id','Proyectos en los que ha trabajado', help='Proyectos en los que ha trabajado')
proyectos_ids = fields.Many2many(
'proyectos',
'proyectos_activistas_rel',
'activista_id',
'proyecto_id',
'Proyectos del Activista',
help='Proyectos en los que ha trabajado')
trab_estado_id = fields.Many2one('estado','Estado', help='Estado del lugar de trabajo')
trab_municipio_id = fields.Many2one('municipio','Municipio')
trab_parroquia_id = fields.Many2one('parroquia','Parroquia', help='Parroquia del lugar de trabajo')
repositorio_tipo = fields.Selection([('bitbucket','BitBucket'),('github','GitHub')],'Tipo de Repositorio',required=True, help='Tipo de Repositorio ')
repositorio_url = fields.Char('URL de la Cuenta',size=50, help='URL de la Cuenta del Repositorio')
#Método utilizado para personalizar el _rec_name para que muestre nombres y apellidos juntos
def name_get(self, cr, uid, ids, context=None):
res = []
activistas = self.browse(cr, uid, ids, context)
for activista in activistas:
res.append((activista.id, activista.nombres + ' ' + activista.apellidos))
return res
@api.onchange('dom_estado_id')
def _on_change_limpiar_dom(self):
self.dom_municipio_id = ''
self.dom_parroquia_id = ''
@api.onchange('dom_municipio_id')
def _on_change_limpiar_dom_parroquia(self):
self.dom_parroquia_id = ''
@api.onchange('trab_estado_id')
def _on_change_limpiar_trab(self):
self.trab_municipio_id = ''
self.trab_parroquia_id = ''
@api.onchange('trab_municipio_id')
def _on_change_limpiar_trab_parroquia(self):
self.trab_parroquia_id = ''
class Proyectos(models.Model):
"""Proyectos en los que ha trabajado el Activista"""
_name = 'proyectos'
_rec_name = 'proyecto'
proyecto = fields.Char(size=50,required=True, help='Nombre del Proyecto en el que ha trabajado')
activista_id = fields.Many2many(
'activista',
'proyectos_activistas_rel',
'proyecto_id',
'activista_id' ,
'Activistas en el proyecto',
help='Activistas que han trabajado en este Proyecto')