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
    Food & Hospitality
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Guest House
    • Distribuidor de bebidas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consulting
    • Accounting Firm
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Trades
    • Handyman
    • Hardware y asistencia informática
    • Solar Energy Systems
    • Zapatero
    • Servicios de limpieza
    • HVAC Services
    Others
    • Nonprofit Organization
    • 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

Inherit modules order

Suscribirse

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

Se marcó esta pregunta
inheritanceinheritorderpriorityodoo
2 Respuestas
2674 Vistas
Avatar
Onik

I created a module to customize pos receipt template. But when other module is installed after my module which also changes the same thing i change my changes get override. I want to know if there is an attribute that i can add so my module would load last. I tried using priority="100" but that didnt work.

?xml version="1.0" encoding="UTF-8"?>

templates id="template" xml:space="preserve">

​t t-name="pos_receipt.OrderReceipt" t-inherit="point_of_sale.OrderReceipt" priority="1" t- ​ ​inherit-mode="extension"> 

​ ​xpath expr="//p[@t-if='props.data.isRestaurant']" position="replace"> 

​ ​​p t-if="props.data.isRestaurant">

 

​ ​/xpath> 

​ ​xpath expr="//p[@t-else='']" position="replace"> 

​ ​ ​p t-else="">

 

​ ​/xpath> 

​/t>

​t t-name="pos_receipt.ReceiptHeader" t-inherit="point_of_sale.ReceiptHeader" t-inherit- ​ ​mode="extension"> 

​ ​xpath expr="//img" position="replace"> 

​ ​ ​img/> 

​ ​/xpath> 

​/t>

/templates>

0
Avatar
Descartar
Avatar
S.A. Methsiri Madusanka Sooriyaarachchi
Mejor respuesta

To ensure your module's changes take precedence and are loaded after other modules, you can use the following strategies:

1. Use the depends Attribute:

  • Ensure that your module explicitly depends on the other modules you want to override. This forces your module to load after the modules it depends on.
  • In your __manifest__.py file, add the other modules to the depends list:
pythonCopy code{
    'name': 'Your Module',
    'depends': ['point_of_sale', 'other_module_name'],
    # other attributes
}

2. Use sequence in data Section:

  • In your __manifest__.py, ensure your XML file is loaded after others by specifying the sequence in the data section.
  • For example:
pythonCopy code{
    'name': 'Your Module',
    'depends': ['point_of_sale'],
    'data': [
        'views/your_template.xml',
    ],
    'sequence': 150,  # Higher sequence ensures it loads later
}

3. Use the noupdate="1" Flag:

  • You can use the noupdate="1" attribute in your XML to prevent your changes from being overridden by subsequent updates or other modules.
xmlCopy code
    

4. Leverage the depends in Odoo 15+ (Advanced):

  • For Odoo 15 and later, there’s a more advanced mechanism where you can use the _order attribute in the class definition to ensure your code execution happens after other similar modules.
  • However, this is more applicable for Python code rather than XML template overrides.

Example of Updated XML:

Here's an updated XML structure with priority="100" as well as ensuring noupdate="1" and checking the sequence in the manifest:

xmlCopy code
    
         
             
                

Final Checks:

  • Ensure your module's sequence and dependencies are correctly set in __manifest__.py.
  • If the issue persists, verify that no other module is loaded afterward with a higher sequence or overrides in its own way that could conflict with your changes.

1
Avatar
Descartar
Onik
Autor

The code parts are not visible. Can you fix that so I can see full solution )

S.A. Methsiri Madusanka Sooriyaarachchi

<odoo>
<template id="template" xml:space="preserve" noupdate="1">
<t t-name="pos_receipt.OrderReceipt" t-inherit="point_of_sale.OrderReceipt" priority="100" t-inherit-mode="extension">
<xpath expr="//p[@t-if='props.data.isRestaurant']" position="replace">
<p t-if="props.data.isRestaurant">
<!-- Your customized content -->
</p>
</xpath>
<xpath expr="//p[@t-else='']" position="replace">
<p t-else="">
<!-- Your customized content -->
</p>
</xpath>
</t>

<t t-name="pos_receipt.ReceiptHeader" t-inherit="point_of_sale.ReceiptHeader" t-inherit-mode="extension">
<xpath expr="//img" position="replace">
<img/>
</xpath>
</t>
</template>
</odoo>

Onik
Autor

Adding sequence to manifest worked for me. Thanks

Avatar
Anaghan Heri
Mejor respuesta

Hi,

You can try this approach. Instead of replacing the image, which might affect other modules using this class, it’s better to hide it. This way, the image remains intact for other uses, and your changes will only apply where needed.

-1
Avatar
Descartar
Onik
Autor

I appreciate the corrections but that wasnt my request. The problem was written in my post. My code works quite right the problem is that if for example i create another module and install it after this module which change the same template tags my code gets overwritten. I want to know if there is a way to make my code not be overwritten.

¿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 extend an existing class and include social newtork features in the sub class
inheritance inherit
Avatar
Avatar
3
jul 18
4642
How to inherit class ? Resuelto
inheritance odoo
Avatar
Avatar
Avatar
2
mar 15
7016
How css and js inheritance works on Odoo v8? Resuelto
v8 inheritance inherit css point_of_sale odoo
Avatar
Avatar
Avatar
Avatar
5
abr 23
34674
Odoo 18 - override Utils
inheritance odoo odoo18
Avatar
0
jun 25
1931
Cancelled order reintegrate the item into the stock ?
stock order odoo
Avatar
0
mar 24
1959
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