Odoo Help


TypeError: on_change_month_wage() takes at most 6 arguments (7 given)

Giovanny Vizcaya
on 1/19/15, 9:19 AM 1,143 views

Good day, I am developing a payroll module adapted to Venezuelan law and I'm creating a function that seeks the daily wage of an employee, all that came out well, the module makes the calculation, but; when I want to save the log I get this error: "TypeError: on_change_month_wage() Takes at most six arguments (7 Given)"

This is my code:

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

    res = {} if month_wage > 0: res['diary_wage'] = month_wage / 30 return {'value': res}

_columns = {

'month_wage':fields.float('Salario Mensual', digits=(16,2)), 'diary_wage':fields.function(on_change_month_wage, type = 'float', string = 'Salario Diario'),


and my xml lines:

field name="month_wage" string="Salario Mensual" on_change="on_change_month_wage(month_wage)" field name="diary_wage" string="Salario Diario"

obviously deleted the "< />" for this post

and so... What should i do to solve this error? Thank in advance


You separate on_change and fields.function

on 1/19/15, 1:33 PM

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.


Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 


We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :


  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 1/19/15, 1:53 PM

You are mixing two things together a field.function and onchange method

1./ Try to look for example showing how to define a field.function

   def your_field_dot_function_name(self,cr,uid,ids,fieid_name=None,args=None,context=None):
       <<your function body for calculation>>

    "my_field":fields.function(your_field_dot_function_name,string="Some string",type="float"),


2./ Try to look for definition of method showing the onchange method

XML File:
<field name="myfield" on_change="onchange_myfield(monthwage)"/>

.Py file

def onchange_myfield(self,cr,uid,ids,monthwage,context=None):
    <<your on change function body >>
    return {'value': {}}

Hope this helps !!.

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

1 follower(s)


Asked: 1/19/15, 9:19 AM
Seen: 1143 times
Last updated: 3/16/15, 8:10 AM