Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


When selecting a specific word in may2one do diferents functions?

Fernando Lopez
on 3/20/16, 1:29 PM 233 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)




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)


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 3/20/16, 1:29 PM
Seen: 233 times
Last updated: 3/20/16, 1:58 PM