Skip to Content
Menu
This question has been flagged
2 Replies
2443 Views

Hi 

i have this error when i come to see view


File "C:\Program Files (x86)\Odoo 8\server\.\openerp\models.py", line 5863, in _onchange_eval
TypeError: on_change_secteur_id() takes exactly 2 arguments (5 given)
Avatar
Discard
Author Best Answer

my code python 

import time

from openerp import models, fields, api

from datetime import datetime

class convention(models.Model):

_name="hr.convention"

_description="Convention"

name = fields.Char(string="Nom",size=128,required=True)

description = fields.Text("Description")

hr_secteur_ids = fields.One2many("hr.secteur.activite","hr_convention_id","Secteurs d'activtés")

convention()

class hr_secteur_activite(models.Model):

_name="hr.secteur.activite"

_description = "Secteur d'activite"

name = fields.Char("Name",size=128,required=True)

description = fields.Text("Description")

hr_convention_id = fields.Many2one("hr.convention",String="Convention",required=True)

hr_categorie_salariale_ids = fields.One2many("hr.categorie.salariale","hr_secteur_activite_id","Catégories salariales")

hr_secteur_activite()

class categorie_salariale(models.Model):

_name = "hr.categorie.salariale"

_description = "Categorie salariale"

name = fields.Char('Libellé', size=64, required=False, readonly=False)

salaire_base = fields.Float('Salaire de base')

description = fields.Text('Description')

hr_secteur_activite_id = fields.Many2one("hr.secteur.activite","Secteur d'activté")

def write(self, vals):

for salarie in self.browse(vals):

for contract in salarie.contract_ids:

#raise osv.except_osv(_('TEST'),contract)

cr.execute('UPDATE hr_contract set wage=%s WHERE id=%s',(salarie.salaire_base,contract.id))

cr.commit()

return super(categorie_salariale,self).write(vals)

categorie_salariale()


and XML 


<field name="hr_convention_id" on_change="on_change_convention_id(hr_convention_id)"/>

<field name="hr_secteur_id" on_change="on_change_secteur_id(hr_secteur_id)"/>

<field name="categorie_salariale_id" on_change="change_categorie(categorie_salariale_id)"/>

Avatar
Discard
Best Answer

You seem that you defined the on_change_secteur_id as follows

def on_change_secteur_id(self, cr):
...

and in the xml file you seem that you passed other parameters not defined in the method signature, noting that the self, cr, uid parameters are counted implicitly.

You have to review the parameters your method and be sure that all parameters passed in the xml file are defined in the method definition

Avatar
Discard
Related Posts Replies Views Activity
1
Jul 19
2353
0
Jul 17
2670
3
Feb 18
4893
2
Sep 23
3450
12
Oct 23
34761