I'm trying to generate a function to return a computed value to a field while I modify another field using the following code:
from openerp import models,fields,api
class exec_modl(models.Model):
_name = "exec.modl"
_rec_name = "exec_desc"
exec_code = fields.Char('Identificador',required=True,size=3)
exec_desc = fields.Char('Descripción',required=True)
cour_exec = fields.Many2one('cour.modl')
proc_exec = fields.Many2one('enro.modl')
inte_code = fields.Char(compute='_onchange_proc') #a field for the internal_id I'm generating
This is my test function, as a start im just trying to print a static value into the field, my second milestone is get values from another models to conform a real internal_id
#test function
@api.onchange('proc_exec')
def _onchange_proc(self):
cate = "XX"
cour = "XXXX"
exet = "XXX"
output = cate+"-"+cour+"-"+exet
return output
Any suggestion to achieve this ? I'm a bit confused about the correct use of functions on fields on odoo v9.