Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
3210 Weergaven

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
Annuleer
Auteur Beste antwoord

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
Annuleer
Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
jul. 19
3198
0
jul. 17
3347
3
feb. 18
5708
2
sep. 23
4968
12
okt. 23
36023