Odoo Help


When selecting a specific word in may2one do diferents functions?

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


About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


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