Skip to Content
Menu
This question has been flagged
2056 Views

I want to create a field composed of others, when you select "PTP" in equipo_id should form a name in "namee" if it is not to be formed under another name.

also I do not know which api can I use.

class kiwi_equipment(osv.osv):

_name = "kiwi.equipos"

_columns = {

'ubicacion': fields.related("namee","ubicacion", type="many2one", string ="Sitio", relation="kiwi.sitios", store = True),

'dir_ip': fields.char('Direccion IP', required=True, help="La IP debe ser válid"),

'tipo_servicio': fields.many2one('kiwi.tiposervicio','Tipo de Servicio', required=True),

'megas_servicio': fields.many2one('kiwi.megas','Mbps', required=True),

'ip_kr': fields.char('IP del Kiwirouter (X.X.X.X/Z)'),

'no_vlan': fields.char('VLAN'),

'ip_adicional': fields.char('IP Adicional (X.X.X.X/Z)'),

'equipo_activo': fields.boolean('Equipo Activo'),

'sm': fields.boolean('SM'),

'coordenada_id': fields.related("namee","coordenada_id", type="many2one", string ="Coordenada", relation="kiwi.coordenada", store = True),

'equipo_id': fields.related("namee","equipo_id", type="many2one", string ="Tipo de equipo", relation="kiwi.equipo", store = True),

localizacion_id': fields.related("namee","localizacion_id", type="many2one", string ="Localizacion", relation="kiwi.localizacion", store = True),

'namee': fields.text('Network ID', readonly = True)

}

@api.one

@api.onchange('ubicacion','localizacion_id','coordenada_id','equipo_id','namee')

def _onchange_porr(self):

if self.equipo_id == 'PTP':

if self.ubicacion and self.localizacion_id and self.coordenada_id and self.equipo_id and self.namee:

self.namee = str(self.ubicacion.namee) + "-" + str(self.localizacion_id.namee) + "-" + str(self.coordenada_id.namee) + "-" + str(self.equipo_id.namee) + "TO" + str(self.namee.namee)

kiwi_equipment()

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 23
12549
1
Aug 23
11054
1
Jul 23
7228
4
Apr 23
8677
2
Feb 23
17600