The easiest example is of the on_change function. Here i give you an example of a call to a function.
def on_change_state_id(self, cr, uid, ids,state, project, credit, context=None):
if state==1:
project_id = _get_project_id_by_name (self,cr, uid, project, context)
res = {'value':{'service_ids': self.get_inputs(cr, uid, ids, state, project,context=context),
}
}
return res
else:
return False
---------------------------------------------------
def get_inputs(self, cr, uid,ids, state, project, context=None):
ret = []
project_id = _get_project_id_by_name (self,cr, uid, project, context
obj = self.pool.get('tes.project.service')
obj_ids = obj.search(cr, uid, [], context=context)
res = obj.read(cr, uid, obj_ids, ['id', 'int_service','ext_service','unit_service','int_service_unit','ext_service_unit','service_type','service_condition'], context)
for r in res :
inputs = {
'project_id' : project_id,
'int_services': r['int_service'],
'ext_services': r['ext_service'],
'unit_services': r['unit_service'],
'int_services_unit': r['int_service_unit'],
'ext_services_unit': r['ext_service_unit'],
'service_type': r['service_type'],
'service_condition' : r['service_condition'],
}
ret.append(inputs)
print ('------------liste de services-------')
print ret
return ret
Try simpler case like this:
def func2(msg):
return 'result of func2("' + func1(msg) + '")'
def func1(msg):
return 'result of func1("' + msg + '")'
print func1('test')
print func2('test')
It prints:
result of func1("test")
result of func2("result of func1("test")")
Notice the order of function definitions is intentionally reversed. The order of function definitions does not matter in Python.
Regards.