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

Qweb : error using a condition to add </tr><tr> to change row inside a foreach

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
qwebeditornoobxmlviewOdooSH
2 Replies
5065 Tampilan
Avatar
Hedge

Hi all !

I'll try to be as clear as possible.

I'm creating a web view so creating an xml file.

I have a table to show different size of same product.
But if there is more than 7 I want to create a new row to keep it clear on webpage.
So I have a conditional on the index_i variable (didn't still understood how to use $a_index)
when 7 is reached I want to add "</tr><tr>" to make a new row.
But when updating the module I have an error :"lxml.etree.XMLSyntaxError: expected '>' "

Here is my code :

<table border="1">
                                    <tr>
                                        <t t-set="attribute" t-value="toto.product_variant_ids"/>
                                        <t t-set="index_i" t-value="1"/>
                                        <t t-foreach="attribute" t-as="tutu">
                                            <p t-if="index_i==7">
                                                </tr><tr>             
                                            </p>
                                            <td>
                                                <p t-esc="tutu.display_name"/>
                                            </td>
                                            <t t-set="index_i" t-value="index_i+1"/>
                                         </t>
                                    </tr>
                                </table>


Any idea ?


Thanks a lot !

================  THE SOLUTION : ============

I changed this part of code :
                                            <p t-if="index_i==7">
                                                </tr><tr>             
                                            </p>

by :
                                            <t t-if="index_i==10 or index==5">
                                                <tr></tr>
                                            </t>

note the inversion of <tr></tr>

0
Avatar
Buang
Avatar
Husain Rangwala
Jawaban Terbai

Hello Hedge
May be issue is in </tr><tr> tag because you are closing tag which is not opened yet so update your code.

<table border="1">
                                    <tr>
                                        <t t-set="attribute" t-value="toto.product_variant_ids"/>
                                        <t t-set="index_i" t-value="1"/>
                                        <t t-foreach="attribute" t-as="tutu">
                                            <p t-if="index_i==7">
                                                <tr></tr>             
                                            </p>
                                            <td>
                                                <p t-esc="tutu.display_name"/>
                                            </td>
                                            <t t-set="index_i" t-value="index_i+1"/>
                                         </t>
                                    </tr>
                                </table>

Thanks

0
Avatar
Buang
Avatar
Hedge
Penulis Jawaban Terbai

Hi Husain !

Thanks to answer !

In fact the opening <tr> is in line 2.
So when the index rate 7 to create a new line, I close the first row and create a second in line 7.
then I open <td> whatever the index is !

Have a nice day

0
Avatar
Buang
Husain Rangwala

You can not close </tr> tag like this if you want to close that opening <tr> then you must first close </P> and then </t> tag which is inner tag.

Hedge
Penulis

Hi Husain !

Ha ok !? but If I do that my loop will stop ?

Husain Rangwala

Simply you just need to open and close <tr></tr> inside loop.

Remove tr tag from starting.

Hedge
Penulis

So the solution was in between ;-) :

I changed this part of code :

<p t-if="index_i==7">

</tr><tr>

</p>

by :

<t t-if="index_i==10 or index==5">

<tr></tr>

</t>

note the inversion of <tr></tr>

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
[Odoo SH] How to order by child fields ?
python xml qweb OdooSH
Avatar
Avatar
1
Feb 21
3420
How to Override Odoo 17 Template Without Locking Web Editor Blocks (Snippets)?
community qweb editor blocks 17.0
Avatar
0
Agu 24
2846
Frontend Editor: disable editing of t-field values
editable qweb editor frontend t-field
Avatar
Avatar
1
Des 20
7234
Qweb Editor problem "Insert blocks" not working + Japanese characters
invoice qweb rml report editor
Avatar
0
Agu 15
3978
Odoo 18: Display image from char field containing url in qweb form
qweb
Avatar
Avatar
1
Jul 25
3161
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