Odoo Help


Error on argument list when extend onchange method

Victor Godayer
on 3/25/15, 12:51 PM 1,637 views


I try to extend the method product_id_change from the model account.invoice.line as follow :

from openerp.osv import osv, fields

from openerp import api

import openerp.addons.decimal_precision as dp

class account_invoice_line(osv.osv):

     _inherit = 'account.invoice.line'

         _columns = {

         'price_unit_with_tax':fields.float(string='Prix Unitaire TTC', digits= dp.get_precision('Product Price'), readonly=True,),



     def product_id_change(self, product, uom_id, qty=0, name='', type='out_invoice',

             partner_id=False, fposition_id=False, price_unit=False, currency_id=False,


         res = super(account_invoice_line, self).product_id_change(product, uom_id, qty=qty, name=name, type=type,

         partner_id=partner_id, fposition_id=fposition_id, price_unit=price_unit, currency_id=currency_id,company_id=company_id)

         if res == 0:

              return res

         context = self._context


        return res

But when I change the product on an invoice line, I get an error saying that I provide too much arguments :

TypeError: product_id_change() takes at most 11 arguments (15 given)

But the definition of my method product_id_change respect the same number of argument !

I can't get what's wrong in my code!

Thank you for your help




| 6 5 7
Lodz, Poland

On 3/25/15, 3:17 PM

You mix new and old api. Relpace

class account_invoice_line(osv.osv): 


class account_invoice_line(models.Model):

Thank you for your reply. But if I change to models.Model, then I get another error which make no sense to me : File ".../openerp-server/lib.linux-x86_64-2.7/openerp/models.py", line 5668, in onchange if field_name and field_name not in self._fields: TypeError: unhashable type: 'list'

Victor Godayer
on 3/26/15, 3:57 AM

In new api line 'price_unit_with_tax':fields.float(string='Prix Unitaire TTC', digits= dp.get_precision('Product Price'), readonly=True,) must like this: price_unit_with_tax = fields.Float(string='Prix Unitaire TTC', digits= dp.get_precision('Product Price'), readonly=True,) without _column definition. Or... other isssue.

on 3/26/15, 6:03 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.


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: 3/25/15, 12:51 PM
Seen: 1637 times
Last updated: 3/25/15, 3:17 PM