Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Help

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Inherit modules order

Odoberať

Get notified when there's activity on this post

This question has been flagged
inheritanceinheritorderpriorityodoo
2 Replies
2632 Zobrazenia
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
Zrušiť
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
Zrušiť
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
Zrušiť
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!

Registrácia
Related Posts Replies Zobrazenia Aktivita
How to extend an existing class and include social newtork features in the sub class
inheritance inherit
Avatar
Avatar
3
júl 18
4638
How to inherit class ? Solved
inheritance odoo
Avatar
Avatar
Avatar
2
mar 15
7006
How css and js inheritance works on Odoo v8? Solved
v8 inheritance inherit css point_of_sale odoo
Avatar
Avatar
Avatar
Avatar
5
apr 23
34664
Odoo 18 - override Utils
inheritance odoo odoo18
Avatar
0
jún 25
1914
Cancelled order reintegrate the item into the stock ?
stock order odoo
Avatar
0
mar 24
1948
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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