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
    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
    • Bricoleur
    • 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
    • Devenez 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

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

Issue with Tests After Installing the Contacts Module on Odoo 18 (Odoo.sh)

S'inscrire

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

Cette question a été signalée
modulestestcodeodoo.shOdoo.sh
2 Réponses
3640 Vues
Avatar
Félicien Catherin

Hi everyone,

I'm using Odoo.sh to build my custom module, but I've encountered an issue with tests.

At first, I thought the problem was with my code. However, after completely removing everything and restarting from a fully empty branch (0 commits), I noticed that the following command works perfectly on a blank database:

odoo-bin --test-enable --stop-after-init --log-level=test

But if I install the Contacts module (via the app installation interface) and rerun the same test command:

odoo-bin --test-enable --stop-after-init --log-level=test

I immediately get many errors like this:

odoo.sql_db: bad query: b'INSERT INTO "res_users" ("active", "company_id", "create_date", "create_uid", "login", "partner_id", "write_date", "write_uid") VALUES (true, 1, '2025-02-15 00:04:13.125900', 1, 'u1', 578, '2025-02-15 00:04:13.125900', 1) RETURNING "id"' ERROR: null value in column "notification_type" of relation "res_users" violates not-null constraint DETAIL: Failing row contains (58, 1, 578, t, 2025-02-15 00:04:13.1259, u1, null, null, 1, 1, null, null, 2025-02-15 00:04:13.1259, null, null, null, null, null).

Example traceback:

odoo.addons.base.tests.test_base: ERROR: TestGroups.test_remove_groups Traceback (most recent call last): File "/home/odoo/src/odoo/odoo/addons/base/tests/test_base.py", line 209, in test_remove_groups u1 = self.env['res.users'].create({'login': 'u1', 'name': 'U1'}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<decorator-gen-32>", line 2, in create File "/home/odoo/src/odoo/odoo/api.py", line 479, in _model_create_multi return create(self, [arg]) ^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/odoo/addons/base/models/res_users.py", line 1901, in create users = super(UsersView, self).create(new_vals_list) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<decorator-gen-30>", line 2, in create File "/home/odoo/src/odoo/odoo/api.py", line 480, in _model_create_multi return create(self, arg) ^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/odoo/addons/base/models/res_users.py", line 1602, in create return super(UsersImplied, self).create(vals_list) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<decorator-gen-28>", line 2, in create File "/home/odoo/src/odoo/odoo/api.py", line 480, in _model_create_multi return create(self, arg) ^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/odoo/addons/base/models/res_users.py", line 706, in create users = super(Users, self).create(vals_list) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<decorator-gen-0>", line 2, in create File "/home/odoo/src/odoo/odoo/api.py", line 480, in _model_create_multi return create(self, arg) ^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/odoo/models.py", line 4975, in create records = self._create(data_list) ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/odoo/src/odoo/odoo/models.py", line 5159, in _create cr.execute(SQL( File "/home/odoo/src/odoo/odoo/sql_db.py", line 354, in execute res = self._obj.execute(query, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ psycopg2.errors.NotNullViolation: null value in column "notification_type" of relation "res_users" violates not-null constraint DETAIL: Failing row contains (58, 1, 578, t, 2025-02-15 00:04:13.1259, u1, null, null, 1, 1, null, null, 2025-02-15 00:04:13.1259, null, null, null, null, null).

The error seems to be caused by a missing value in the notification_type column when inserting a new user.

Is there an issue with the Contacts module, or am I doing something wrong?

I'm using Odoo 18 on Odoo.sh with the latest revision.

Thanks in advance for your help!


0
Avatar
Ignorer
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Meilleure réponse

Hi,

The issue you're encountering is related to the notification_type field in the res.users model, which is a required field (not null) in Odoo. When creating a new user, this field must be provided, but it seems that the test or the Contacts module is not setting it correctly.


Set a Default Value for notification_type

notification_type = fields.Selection(

        selection=[

            ('email', 'Handle by Emails'),

            ('inbox', 'Handle in Odoo'),

        ],

        default='email',  # Set a default value

        required=True,

    )

Update Existing Users

UPDATE res_users SET notification_type = 'email' WHERE notification_type IS NULL;


Hope it helps

0
Avatar
Ignorer
Avatar
Sandeep Sonare
Meilleure réponse

Update all modules once then try it again.

0
Avatar
Ignorer
Félicien Catherin
Auteur

Thank you for your answer but it is still the same : I cliked update al modules from the online editor and then launched the test again and I still have the same error

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 - How can I spin up a blank dev branch without the addons?
modules odoo.sh Odoo.sh
Avatar
0
nov. 20
57
Unable to drag builds between branches in Odoo.sh (works on other computers) Résolu
odoo.sh Odoo.sh
Avatar
Avatar
1
oct. 25
1149
How can I extend an Odoo.sh staging branch due to expire soon? Résolu
odoo.sh Odoo.sh
Avatar
Avatar
2
nov. 25
5288
module working fine on staging but not production on odoo.sh
odoo.sh Odoo.sh
Avatar
Avatar
1
mars 24
3152
unable to install Odoo module .
modules odoo.sh
Avatar
Avatar
Avatar
2
mars 24
3393
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