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
    • Intelligence artificielle
    • 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
    • Supermarché
    • Quincaillerie
    • Magasin de jouets
    Restauration & Hôtellerie
    • 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
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Homme à tout faire
    • Matériel informatique & 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
    Parcourir toutes les 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
    • Devenir partenaire
    • Services pour partenaires
    • 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
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

Odoo.sh build testing failing due to custom python constraint. How can I fix?

S'inscrire

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

Cette question a été signalée
constraintstestsodoo.sh
5797 Vues
Avatar
Russ Schneider

Odoo.sh 14

When committing to a development branch, the Odoo Test Suite is failing the TestFormCreate.test_create_res_partner because of a constraint I added to check to make sure a custom field ('ssn') was in either SSN or EIN format.

I don't know how this test is testing this field.  Is there any way to exclude this constraint from the test?  What's the best practice here?


class Custom(models.Model):
_inherit = "res.partner"

ssn = fields.Char(string='Social Security # / EIN', size=11)

@api.constrains('ssn')
def _check_ssn(self):
from stdnum import get_cc_module
modssn = get_cc_module('us', 'ssn')
modein = get_cc_module('us', 'ein')

for record in self:
error_flag = 0
try:
modssn.validate(record.ssn)
except:
error_flag+= 1
try:
modein.validate(record.ssn)
except:
error_flag+= 1
if error_flag == 2:
raise ValidationError('Social Security # / EIN field is not valid EIN or SSN format.')
03/03/2021 11:31:22ERRORserverERROR: TestFormCreate.test_create_res_partner Traceback (most recent call last): File "/home/odoo/src/odoo/odoo/addons/base/tests/test_form_create.py", line 33, in test_create_res_partner partner_form.save() File "/home/odoo/src/odoo/odoo/tests/common.py", line 1884, in save r = self._model.create(values) File "<decorator-gen-154>", line 2, in create File "/home/odoo/src/odoo/odoo/api.py", line 344, in _model_create_multi return create(self, [arg]) File "/home/odoo/src/odoo/addons/partner_autocomplete/models/res_partner.py", line 183, in create partners = super(ResPartner, self).create(vals_list) File "<decorator-gen-95>", line 2, in create File "/home/odoo/src/odoo/odoo/api.py", line 345, in _model_create_multi return create(self, arg) File "/home/odoo/src/odoo/odoo/addons/base/models/res_partner.py", line 562, in create partners = super(Partner, self).create(vals_list) File "<decorator-gen-133>", line 2, in create File "/home/odoo/src/odoo/odoo/api.py", line 345, in _model_create_multi return create(self, arg) File "/home/odoo/src/odoo/addons/mail/models/mail_thread.py", line 264, in create threads = super(MailThread, self).create(vals_list) File "<decorator-gen-65>", line 2, in create File "/home/odoo/src/odoo/odoo/api.py", line 345, in _model_create_multi return create(self, arg) File "/home/odoo/src/odoo/odoo/addons/base/models/ir_fields.py", line 533, in create recs = super().create(vals_list) File "<decorator-gen-13>", line 2, in create File "/home/odoo/src/odoo/odoo/api.py", line 345, in _model_create_multi return create(self, arg) File "/home/odoo/src/odoo/odoo/models.py", line 3866, in create records = self._create(data_list) File "/home/odoo/src/odoo/odoo/models.py", line 4039, in _create records._validate_fields(name for data in data_list for name in data['stored']) File "/home/odoo/src/odoo/odoo/models.py", line 1256, in _validate_fields check(self) File "/home/odoo/src/user/psd_custom/models/res_partner.py", line 38, in _check_ssn raise ValidationError('Social Security # / EIN field is not valid EIN or SSN format.') odoo.exceptions.ValidationError: Social Security # / EIN field is not valid EIN or SSN format.
0
Avatar
Ignorer
Russ Schneider
Auteur

I found a work around by adding a default, but I'd still like to know what the BEST solution would be.

ssn = fields.Char(string='Social Security # / EIN', size=11, default='000-00-0000')

Russ Schneider
Auteur

Actually the default DIDN'T work. :(

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é
Odoo.sh v.15 Tests failed "Please check install log." Nothing in the install log aside from the message shown. Résolu
tests odoo.sh v15
Avatar
Avatar
Avatar
3
août 25
5987
Odoo.sh test sporadically fail with Can't load service 'localization' because: TypeError: Failed to fetch (odoo 16)
javascript tests odoo.sh 16.0
Avatar
Avatar
1
oct. 24
3627
Same error (build failed) on multiple Odoo.sh instances (Odoo enterprise v11) Résolu
accounting tests odoo.sh odoov11
Avatar
Avatar
2
août 18
7763
Migration from Odoo Online to Odoo.sh Résolu
odoo.sh
Avatar
Avatar
1
mai 26
2194
Built an odoo.sh alternative, would love your feedback
odoo.sh
Avatar
0
nov. 25
18
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
  • Devenir 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 Svenska ภาษาไทย 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