Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

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

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
modulestestcodeodoo.shOdoo.sh
2 Respuestas
3648 Vistas
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
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

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
Descartar
Avatar
Sandeep Sonare
Mejor respuesta

Update all modules once then try it again.

0
Avatar
Descartar
Félicien Catherin
Autor

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

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
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) Resuelto
odoo.sh Odoo.sh
Avatar
Avatar
1
oct 25
1150
How can I extend an Odoo.sh staging branch due to expire soon? Resuelto
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
mar 24
3153
unable to install Odoo module .
modules odoo.sh
Avatar
Avatar
Avatar
2
mar 24
3395
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Sitio web hecho con

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