Odoo Help


TypeError: button_calculate_monthly_interest() takes exactly 1 argument (5 given)

Arjun Khode
on 3/24/15, 2:24 AM 4,574 views

I have written this button which does a simple operation, but Odoo says my arguments are wrong. Its an 'object' type button. Can you help me out?


Here's my code:


from openerp.osv import fields, osv

from openerp import api

import openerp.addons.decimal_precision as dp

from openerp.osv import orm

from calendar import monthrange

from datetime import datetime, timedelta

from dateutil import relativedelta

class record(orm.Model):



def button_calculate_monthly_interest(self):

print 'hello Odoo'

def button_monthly_interest(self, cr, uid, ids, context=None):



<button name="button_calculate_monthly_interest" string="Calculate Monthly Interest" type="object"/>

When I use the old API, I get AttributeError: 'record' object has no attribute 'button_monthly_interest'

When I use new API, I get the error: 1 exact field expected, 5 given.


Jérémy Kersten (jke)

--Jérémy Kersten (jke)--

| 3 3 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 3/24/15, 2:59 AM


Should be 

def button_calculate_monthly_interest(self, cr, uid, ids, context=None):
print 'Hello World for current ids (%s)' % ids

or in new API

def button_calculate_monthly_interest(self):
        print 'hello Odoo'


Arjun Khode
On 3/24/15, 4:09 AM

Thank you Mariusz and Jeremy for your answers. But I'm still getting the same type error despite the changes made in the code. expecting 1 parameter but 5 given. What should I do?

Please update your question with full py code (including imports) so we do know what API do you use.

Currenda Sp. z o.o., Mariusz Mizgier
on 3/24/15, 5:32 AM

Thats bad - try it like http://pastebin.com/6zmG6Q9k . Try optimizing your imports as well.

Currenda Sp. z o.o., Mariusz Mizgier
on 3/24/15, 10:00 AM

Mariusz Mizgier

--Mariusz Mizgier--
| 4 1 7
SOPOT, Poland
--Mariusz Mizgier--

OpenERP developer

Mariusz Mizgier
On 3/24/15, 2:56 AM

I guess you are using new api (your class is models.Model), then you should write before your method @api.multi

Take a look at http://odoo-new-api-guide-line.readthedocs.org/en/latest/ for further reference.

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.


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

3 follower(s)


Asked: 3/24/15, 2:24 AM
Seen: 4574 times
Last updated: 3/24/17, 9:41 AM