Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

TypeError: _get_valid_digit() takes exactly 2 arguments (1 given) - Odoo v8 to Odoo v10 community

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
migrationlocalizationodooV8odoov10
1 Répondre
6967 Vues
Avatar
Alberto

Consider this function:

    @api.multi
    def _validate_rif(self, vat): #, cr, uid, vat, context=None
        '''validates if the VE VAT NUMBER is right
        @param vat: string: Vat number to Check
        returns vat when right otherwise returns False

        '''
        if not vat:
            return False

        if 'VE' in vat:
            vat = vat[2:]

        if re.search(r'^[VJEGP][0-9]{9}$', vat):
            valid_digit = self._get_valid_digit()
            if valid_digit is None:
                return False
            if int(vat[9]) == valid_digit:
                return vat
            else:
                self._print_error(_('Vat Error !'), _('Invalid VAT!'))
        elif re.search(r'^([VE][0-9]{1,8})$', vat):
            vat = vat[0] + vat[1:].rjust(8, '0')
            valid_digit = self._get_valid_digit()
            vat += str(valid_digit)
            return vat
        return False

This is from a migration I'm doing from v8 to v10 community.

The error comes on this line: `valid_digit = self._get_valid_digit()`

This calls for this function:

    @api.multi
    def _get_valid_digit(self, vat): #, cr, uid, vat, context=None
        '''
        @param vat: string
        returns validating digit
        '''
        #vat = ''
        divisor = 11
        vat_type = {'V': 1, 'E': 2, 'J': 3, 'P': 4, 'G': 5}
        mapper = {1: 3, 2: 2, 3: 7, 4: 6, 5: 5, 6: 4, 7: 3, 8: 2}
        valid_digit = None

        vat_type = vat_type.get(vat[0].upper())
        if vat_type:
            sum_vat = vat_type * 4
            for i in range(8):
                sum_vat += int(vat[i + 1]) * mapper[i + 1]

            valid_digit = divisor - sum_vat % divisor
            if valid_digit >= 10:
                valid_digit = 0
        return valid_digit

Every time I click on this button it throws me this:

    Traceback (most recent call last):
    File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 638, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
    File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 675, in dispatch
    result = self._call_function(**self.params)
    File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 331, in _call_function
    return checked_call(self.db, *args, **kwargs)
    File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/service/model.py", line 119, in wrapper
    return f(dbname, *args, **kwargs)
    File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 324, in checked_call
    result = self.endpoint(*a, **kw)
    File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 933, in __call__
    return self.method(*args, **kw)
    File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 504, in response_wrap
    response = f(*args, **kw)
    File "/home/kristian/odoov10/odoo-10.0rc1c-20161005/odoo/addons/web/controllers/main.py", line 866, in call_button
    action = self._call_kw(model, method, args, {})
    File "/home/kristian/odoov10/odoo-10.0rc1c-20161005/odoo/addons/web/controllers/main.py", line 854, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
    File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/api.py", line 681, in call_kw
    return call_kw_multi(method, model, args, kwargs)
    File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/api.py", line 672, in call_kw_multi
    result = method(recs, *args, **kwargs)
    File "/home/kristian/odoov10/gilda/l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py", line 64, in search_partner_seniat
    res = self.env['seniat.url']._dom_giver(vat) 
    File "/home/kristian/odoov10/gilda/l10n_ve_fiscal_requirements/model/seniat_url.py", line 226, in _dom_giver
    vat = self._validate_rif(vat)
    File "/home/kristian/odoov10/gilda/l10n_ve_fiscal_requirements/model/seniat_url.py", line 98, in _validate_rif
    valid_digit = self._get_valid_digit()
    TypeError: _get_valid_digit() takes exactly 2 arguments (1 given)

These methods originally looked like this:

    def _get_valid_digit(self, cr, uid, vat, context=None):
        '''
        @param vat: string
        returns validating digit
        '''
        divisor = 11
        vat_type = {'V': 1, 'E': 2, 'J': 3, 'P': 4, 'G': 5}
        mapper = {1: 3, 2: 2, 3: 7, 4: 6, 5: 5, 6: 4, 7: 3, 8: 2}
        valid_digit = None

        vat_type = vat_type.get(vat[0].upper())
        if vat_type:
            sum_vat = vat_type * 4
            for i in range(8):
                sum_vat += int(vat[i + 1]) * mapper[i + 1]

            valid_digit = divisor - sum_vat % divisor
            if valid_digit >= 10:
                valid_digit = 0
        return valid_digit

    def _validate_rif(self, cr, uid, vat, context=None):
        '''validates if the VE VAT NUMBER is right
        @param vat: string: Vat number to Check
        returns vat when right otherwise returns False

        '''
        if not vat:
            return False

        if 'VE' in vat:
            vat = vat[2:]

        if re.search(r'^[VJEGP][0-9]{9}$', vat):
            valid_digit = self._get_valid_digit(cr, uid, vat, context=context)
            if valid_digit is None:
                return False
            if int(vat[9]) == valid_digit:
                return vat
            else:
                self._print_error(_('Vat Error !'), _('Invalid VAT!'))
        elif re.search(r'^([VE][0-9]{1,8})$', vat):
            vat = vat[0] + vat[1:].rjust(8, '0')
            valid_digit = self._get_valid_digit(cr, uid, vat, context=context)
            vat += str(valid_digit)
            return vat
        return False

Any ideas?

0
Avatar
Ignorer
Avatar
Qutechs, Ahmed M.Elmubarak
Meilleure réponse

Hi,

I think in this line: valid_digit = self._get_valid_digit()  you forgot to pass the vat argument to the function !

1
Avatar
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
TypeError: unsupported operand type(s) for +: 'bool' and 'str' - Odoo v8 to Odoo v10 migration Résolu
accounting migration localization odooV8 odoov10
Avatar
Avatar
1
mars 17
13220
TypeError: write() got an unexpected keyword argument 'context' - Odoo v8 to Odoo v10 community Résolu
migration localization odooV8 odoo10
Avatar
Avatar
Avatar
2
nov. 17
36235
Migrate Odoo v8 community fork to odoo 10 community
migration git odooV8 odoov10
Avatar
0
mars 17
4003
TypeError: __init__() takes exactly 2 arguments (3 given) - Odoo v8 to Odoo v10 community Résolu
python invoice migration odooV8 odoov10
Avatar
Avatar
1
mars 17
11537
OpenUpgrade and filestore managment
migration odooV8 openupgrade
Avatar
Avatar
1
mars 23
6608
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now