Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consulting
    • Accounting Firm
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Solar Energy Systems
    • Shoe Maker
    • Serveis de neteja
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Inherit modules order

Subscriure's

Get notified when there's activity on this post

This question has been flagged
inheritanceinheritorderpriorityodoo
2 Respostes
2654 Vistes
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
Best Answer

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
Best Answer

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.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
How to extend an existing class and include social newtork features in the sub class
inheritance inherit
Avatar
Avatar
3
de jul. 18
4640
How to inherit class ? Solved
inheritance odoo
Avatar
Avatar
Avatar
2
de març 15
7012
How css and js inheritance works on Odoo v8? Solved
v8 inheritance inherit css point_of_sale odoo
Avatar
Avatar
Avatar
Avatar
5
d’abr. 23
34670
Odoo 18 - override Utils
inheritance odoo odoo18
Avatar
0
de juny 25
1921
Cancelled order reintegrate the item into the stock ?
stock order odoo
Avatar
0
de març 24
1955
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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