Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Inherit modules order

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
inheritanceinheritorderpriorityodoo
2 Replies
2710 Tampilan
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
Buang
Avatar
S.A. Methsiri Madusanka Sooriyaarachchi
Jawaban Terbai

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
Buang
Onik
Penulis

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
Penulis

Adding sequence to manifest worked for me. Thanks

Avatar
Anaghan Heri
Jawaban Terbai

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
Buang
Onik
Penulis

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.

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
How to extend an existing class and include social newtork features in the sub class
inheritance inherit
Avatar
Avatar
3
Jul 18
4656
How to inherit class ? Diselesaikan
inheritance odoo
Avatar
Avatar
Avatar
2
Mar 15
7057
How css and js inheritance works on Odoo v8? Diselesaikan
v8 inheritance inherit css point_of_sale odoo
Avatar
Avatar
Avatar
Avatar
5
Apr 23
34688
Odoo 18 - override Utils
inheritance odoo odoo18
Avatar
0
Jun 25
1967
Cancelled order reintegrate the item into the stock ?
stock order odoo
Avatar
0
Mar 24
1973
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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