Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
3211 Zobrazení

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šit
Autor Nejlepší odpověď

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šit
Nejlepší odpověď

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šit
Related Posts Odpovědi Zobrazení Aktivita
1
čvc 19
3198
0
čvc 17
3347
3
úno 18
5708
2
zář 23
4968
12
říj 23
36023