Skip to Content
Menu
This question has been flagged
2 Replies
3228 Zobrazenia

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
Zrušiť
Autor 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
Zrušiť
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
Zrušiť
Related Posts Replies Zobrazenia Aktivita
1
júl 19
3226
0
júl 17
3372
3
feb 18
5729
2
sep 23
4984
12
okt 23
36032