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
    • Discuss
    • 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

Odoo10: how to replace inherited qweb template content ?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
odoo10Odoo10.0Odoo10
3 Replies
21124 Tampilan
Avatar
peter

I have tried to insert a tag into an existing template but couldn't get it to work.

Existing template in odoo/addons/mail/static/src/xml/thread.xml

<!-- language: xml -->

    <?xml version="1.0" encoding="UTF-8"?>
    <templates xml:space="preserve">
   
        <t t-name="mail.ChatThread">
            <t t-if="messages.length">
               :
        <t t-name="mail.ChatComposer.Attachments">
            <div class="o_attachments">
                <t t-foreach="attachments" t-as='attachment'>
                    <t t-call="mail.Attachment">
                        <t t-set="editable" t-value="true"/>
                    </t>
                </t>
            </div>
        </t>

        <t t-name="mail.Attachment">
            <div t-attf-class="o_attachment #{attachment.upload ? 'o_attachment_uploading' : ''}" t-att-title="attachment.name">
   
                <a class="o_image" t-att-href='attachment.url' target="_blank" t-att-data-mimetype="attachment.mimetype" t-attf-data-src="/web/image/#{attachment.id}/100x80">
                    <span class='o_attachment_name'><t t-esc='attachment.name'/></span>
                </a>
                <t t-if="editable">
                    <div class="o_attachment_delete">
                        <i class='fa fa-times-circle' title="Delete this attachment" t-att-data-id="attachment.id"/>
                    </div>
                    <div class="o_attachment_progress_bar">
                        Uploading
                    </div>
                </t>
            </div>
        </t>

My custom template (odoo/addons/mycustom/static/src/xml/thread.xml):<br>
I want to insert the Hello world after the class o_image in the original template.

<!-- language: xml -->

    <?xml version="1.0" encoding="UTF-8"?>
    <templates xml:space="preserve">
        <t t-name="mycustom.ImageAttachment" t-extend="mail.Attachment">
            <t t-jquery="o_image" t-operation="append">
                <div>Hello world</div>
            </t>
        </t>
    </templates>

My javascript to render the template (odoo/addons/mycustom/static/src/js/thread.js):

<!-- language: lang-js -->

    odoo.define('mycustom.thread', function (require) {
    "use strict";
   
    var core = require('web.core');
    var ajax = require('web.ajax');
    var qweb = core.qweb;
   
    ajax.loadXML('/mycustom/static/src/xml/thread.xml', qweb);
    console.log("INFO", "Hello World")
   
    });

My assets file (odoo/addons/mycustom/views/assets.xml):

<!-- language: xml -->

    <?xml version="1.0" encoding="utf-8"?>
    <odoo>
        <template id="assets_backend" name="my assets" inherit_id="web.assets_backend">
          <xpath expr="." position="inside">
              <script type="text/javascript" src="/mycustom/static/src/js/thread.js"></script>
          </xpath>
        </template>
    </odoo>

My manifest file (odoo/addons/mycustom/__manifest__.py):

<!-- language: python -->

    # -*- coding: utf-8 -*-
    {
        'name': "test",
   
        'summary': """my test""",
   
        'description': """
            This is my test module.
        """,
   
        'author': "peter",
        'website': "",
   
        # Categories can be used to filter modules in modules listing
        # Check https://github.com/odoo/odoo/blob/master/odoo/addons/base/module/module_data.xml
        # for the full list
        'category': 'Test',
        'version': '0.1',
   
        # any module necessary for this one to work correctly
        'depends': ['base','mail'],
   
        # always loaded
        'data': [
            'views/assets.xml',
        ],
       
        'qweb': [
            'static/src/xml/thread.xml',
        ],
       
    }

The javascript is loaded because I can see the text `Hello World` written on the browser console.
However, I cannot see the `<div>Hello World</div>` in the chat thread. What did I miss?

0
Avatar
Buang
peter
Penulis

sorry for the bad formatting guys, i tried to re-format the code block for my question but i got the 403 - Forbidden reply from Odoo and couldn't update my changes.

Avatar
Daniel Lopez
Jawaban Terbai

Hi Peter,

I found a problem with t-query selector, o_image is not found because it's a class, try with .o_image 


<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
    <t t-name="mycustom.ImageAttachment" t-extend="mail.Attachment">
        <t t-jquery=".o_image" t-operation="append">
            <div>Hello world</div>
        </t>
    </t>
</templates>

Let me know if your problem was fixed

Daniel

0
Avatar
Buang
Avatar
Andrea Alessandrini
Jawaban Terbai

See this answer

https://www.odoo.com/es_ES/forum/ayuda-1/question/replace-all-qweb-template-using-inheritance-94325


0
Avatar
Buang
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
could not execute command lessc in odoo 10 Windows Diselesaikan
odoo10 Odoo10.0
Avatar
Avatar
Avatar
3
Mar 18
16045
leave management odoo 10
odoo10 Odoo10.0
Avatar
Avatar
1
Sep 17
3548
How to hide a measure(field) in odoo10 grph view
odoo10 odoo10.0 odoo10e Odoo10.0 Odoo10
Avatar
Avatar
1
Mar 21
4849
How odoo identify which record they have to return the value of name_search method?
name_search odoo10 odoo10.0 Odoo10.0 Odoo10
Avatar
0
Jul 17
4495
How to print an excel file from form view without using wizard Diselesaikan
openerp odoo10 Odoo10.0
Avatar
Avatar
Avatar
2
Apr 18
8751
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