Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar 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
  • Proyecto
  • 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

Modules - Order of dependencies

Suscribirse

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

Se marcó esta pregunta
modulesdependencies
1 Responder
11695 Vistas
Avatar
Alf Olsen

I can't find any information about the order of dependencies when installing modules. I'm talking about the case where you don't specify any dependencies in __manifest__, just install the modules in some (random) order.

This is a big deal when it comes to overriding class methods and properties both in python and javascript.

Example: Lets say I have 2 modules that each override a method in res.partner, something like the code below.

Which one will run first? And what happens if you update the module that don't run first?

class ResPartner(models.Model):
    _inherit = 'res.partner'
    @api.model_cr
    def init(self):
        super(ResPartner, self).init()
        # some custom code


1
Avatar
Descartar
Alf Olsen
Autor

Sorry about the formating, the editor kind of suck..

Avatar
Richard
Mejor respuesta

The short answer is, without explicitly listing dependencies, there is no guarantee of order.

The process builds a tree and ensures that anything with explicit dependencies to be not processed until all its dependencies are done.  So, two "siblings" will have a similar ranking, and it will have more to do with order it comes back from sql in ir_module_module, which cannot be relied upon.

When you "update" it will only update that module, and anything that depends upon it, meaning that an unrelated module will not "update".

This is exactly why it is poor form to inherit a method and overwrite code without good super calls.

res_partner

    def xxx(self):

        return self.field1 == desired_val


res_partner in module X

     def xxx(self):

         if self.block_xxx:

              return False

          return super().xxx()

and res_partner in module Y

      def xxx(self):

          return True


If module X code is loaded before module Y, then the result will always be True

If module Y code is loaded before module X, then the result will be False if self.block_xxx, otherwise it will be True.

And there is no guarantee that the behaviour will be consistent from one install to the next.

  

1
Avatar
Descartar
Jérôme Thériault

Your answer is on time Richard, I was just looking into this ;)

So this line illustrates that there is no defined order in which modules are loaded:

cr.execute("SELECT name from ir_module_module WHERE state IN %s" ,(tuple(states),))

https://github.com/odoo/odoo/blob/def7d7bb0231fef38e044803b245c9b990a90216/odoo/modules/loading.py#L340

Bummer... I have a case where I'd like to override res_partner.xxx() so all other known and unknown modules benefit from it. Odoo has implemented a "priority" field for views but it looks like they have not for models.

Richard

Ahh, this gets tricky. If they all call super correctly, then they may benefit, depending on what they do (or if they completely override)

Effectively, to be sure, you need to set a dependency(ies) or take your chances.

We have, at times, needed 3, 4, or more modules to achieve what would be nice to do in 1.

module res_partner_xxx depends on crm

res_partner_xxx_sale depends on res_partner_xxx and sale and auto installed, and only has a few lines of code

res_partner_xxx_purchase

res_partner_xxx_yyyy

etc.

Richard

And, even if the read from sql could guarantee an order (like alphabetically), the tree and dependency calcs push them around as lists, recordsets, joining and unioning - it would be foolish to trust any sequence would remain intact without any explicit code to ensure it.

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

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

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
How to have many2one/one2many relation between models from two different modules
modules dependencies v15
Avatar
Avatar
1
jul 22
5635
Nuevo menú en "CRM"
modules
Avatar
Avatar
Avatar
Avatar
3
jul 25
2758
Allow Access to update module
modules
Avatar
Avatar
Avatar
Avatar
3
may 25
4630
Mozaik dependencies
dependencies
Avatar
Avatar
2
jul 24
2049
Dependency priorities on calling super Resuelto
modules dependencies override super
Avatar
Avatar
1
oct 23
3355
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información 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 totalmente integrado.

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