Odoo Help

Welcome!

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.

0

How to call a function inside another function

By
Jihen BEN ALI
on 8/23/15, 6:22 AM 493 views

Hi,

I have this two function:

def _get_input(self, cr, uid, ids,
name, args, context=None):
if context is None:
context = {}
res = {}
total =0
for account in self.browse(cr, uid, ids, context=context):
if account.type == 'receipt':
total += account.amount
logger.info('__total__:%s',total)
res[account.id] = total
else :
res[account.id]= False
return res
def _get_output(self, cr, uid, ids,
name, args, context=None):
if context is None:
context = {}
res = {}
total=0
for account in self.browse(cr, uid, ids, context=context):
if account.type == 'payment' :
total += account.amount
res[account.id] = total
else:
res[account.id] = False
return res

I want to replace res[account.id] = False by the other function, for example in the _get_input I want to call _get_output how can I do it

self._get_output(cr,uid,ids,[account.id], name, args, context=context)

kaisusr
on 8/23/15, 7:44 AM

EDITED: self._get_output(cr,uid,[account.id], name, args, context=context) Don't forget to put it as a valid answer

kaisusr
on 8/23/15, 10:24 AM
0
kaisusr
On 8/23/15, 7:44 AM

res[account.id] = self._get_output(cr,uid,[account.id], {}, {}, context)

Thank you for the answer but nothing change I still getting the same result ???

Jihen BEN ALI
on 8/23/15, 3:18 PM

Edited :)

kaisusr
on 8/24/15, 6:27 AM
0
laribi
On 8/24/15, 4:32 AM


Hello ,

Define def _get_output(...) before def _get_input(...)

Then call it like this :

res[account.id] = self._get_output(cr,uid,[account.id], {}, {}, context)

If I do it as you have said to me I'm getting this error : return float_round(float(value or 0.0), precision_digits=self.digits[1])

Jihen BEN ALI
on 8/24/15, 10:02 AM

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)

Stats

Asked: 8/23/15, 6:22 AM
Seen: 493 times
Last updated: 9/2/15, 3:12 AM