I am using openerp7. I have an on_change function which gives me back the model id. How can I get the name of the model? Here is my code so far:
_columns={
'model': fields.many2one('ir.model', string='Models'),
'model_name': fields.char('Model name')
}
def onchange_model(self, cr, uid, ids, model, context=None):
print model #gives me back the id of the model(if i choose res.partner it gives me {int}73)
# [...]
<field name="model_name" on_change="onchange(model)"/>
So my question is simple: How can I get the name of the model(for example res.partner).
Check if this works (I didn't try it but it should work)
ir_model_obj = self.pool.get('ir.model')
models_ids = ir_model_obj.search(cr, uid, [('id', '=', model)])
for record in ir_model_obj.browse(cr, uid, models_ids, context=context):
_logger.info(record.model) # You get the model here
_logger.info(record.name) # You get the model name here