Odoo Help

0

TypeError: get_inputs() takes at least 8 arguments (7 given) in odoo v8

By
Drees Far
on 7/10/15, 4:56 AM 623 views

Hello everybody!!

Please who knows why do i get this error: TypeError: get_inputs() takes at least 8 arguments (7 given).

Here is my python and my xml.

Python:

def on_change_bill_id(self, cr, uid, ids, partner_id, invoice_mode, context=None):

print ('------------------------Facturations on change--------------------') 

print ('partner =' )

print partner_id

print invoice_mode

res = {'value':{'bill_ids': self.get_inputs(cr, uid, ids, partner_id, invoice_mode, context=context),

'invoice_line': self.get_inputs2(cr, uid, ids, partner_id, invoice_mode, context=context),

}

}

print ('-------------------Onchange-----------------------')

return res


XML:

<field name="date_end" on_change="on_change_bill_id(partner_id, invoice_mode)"/> 

Thanks a lot in advance

post your get_inputs method also... looks like it expects one more argument, also state the class

Bole
on 7/10/15, 5:09 AM

Hey!!!! I was asking you. If there is a problem say yes if no say No

Drees Far
on 7/10/15, 5:33 AM

sry .. been out on meeting... from here both methods looks fine, number of args seems ok fro both methods, is it possible that you have methods with same name in some other class and you are calling it ? check that.. if that is not the case.. i have no clue what else could be wrong..

Bole
on 7/10/15, 7:27 AM
0

Drees Far

--Drees Far--
1144
| 5 2 6
Tunis, Tunisia
--Drees Far--
Drees Far
On 7/10/15, 5:16 AM

Here is the get_inputs:


def get_inputs2(self, cr, uid,ids, partner_id, invoice_mode, context=None):

res = {}

ret = []

if partner_id == False:

raise except_orm(

_('Error!'),

_("Please, select a partner for your invoice.")

)

if invoice_mode == False:

raise except_orm(

_('Error!'),

_("Please, select the invoice mode for your invoice.")

github_url = '##################################################'

res = "-"

buffer = StringIO()

c = pycurl.Curl()

c.setopt(pycurl.URL, github_url)

c.setopt(pycurl.HTTPHEADER, ['X-Postmark-Server-Token: API_TOKEN_HERE','Accept: application/json'])

c.setopt(c.WRITEFUNCTION, buffer.write)

c.perform()

c.close()

body = buffer.getvalue()

print (body)

resp = json.loads(body)

print (resp)

if resp['result'] != 'ok' :

print 'Error : (' + resp['error_code'] +')' + resp['error']

else :

for r in resp['bill'] :

inputs = {

'product_id' : 1,

'price_unit' : 50,

'quantity' : r['quaantity'],

'account_id' : 19,

'uos_id' : r['unit'], 

}

ret.append(inputs)

print ret

return ret

#########################################"


def get_inputs(self, cr, uid,ids, partner_id, invoice_mode, context=None):

res = {}

ret = []

github_url = '######################################'

res = "-"

buffer = StringIO()

c = pycurl.Curl()

c.setopt(pycurl.URL, github_url)

c.setopt(pycurl.HTTPHEADER, ['X-Postmark-Server-Token: API_TOKEN_HERE','Accept: application/json'])

c.setopt(c.WRITEFUNCTION, buffer.write)

c.perform()

c.close()

body = buffer.getvalue()

print (body)

resp = json.loads(body)

print (resp)

if resp['result'] != 'ok' :

print 'Error : (' + resp['error_code'] +')' + resp['error']

else :

for r in resp['bill'] :

inputs = {

'service_id' : r['service_id'],

'name' : r['name'],

'unit' : r['unit'],

}

ret.append(inputs)

print ret

return ret

I think there is no problem. No??!!!

Drees Far
on 7/10/15, 5:22 AM

I gave you both: get_inputs and get_inputs2

Drees Far
on 7/10/15, 5:28 AM

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.

Register

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)

Stats

Asked: 7/10/15, 4:56 AM
Seen: 623 times
Last updated: 7/10/15, 7:27 AM