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
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • 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
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • 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

Element cannot be located in parent view ERROR. vOdoo17

Subscriure's

Get notified when there's activity on this post

This question has been flagged
xmlerrorsxml_idelementsodoo17
2 Respostes
1373 Vistes
Avatar
Elijah Nyendwa

Hello, i am trying to create a custom customer statement template in odoo17 but i keep getting this error in the terminal that doesn't quite make sense, i have reviewed my code, given it to AI and still nothing but the same error:



odoo.tools.convert.ParseError: while parsing None:4

Error while parsing or validating view:


Element '<t t-name="zra_smart_invoice.report_customer_statement_aged">' cannot be located in parent view


View error context:

{'file': 'c:\\program '

'files\\odoo17\\odoo17-dev\\custom\\zra_smart_invoice\\report\\report_customer_statement_aged.xml',

'line': 2,

'name': 'report_customer_statement_aged',

'view': ir.ui.view(2191,),

'view.model': False,

'view.parent': ir.ui.view(2089,),

'xmlid': 'report_customer_statement_aged'}


I don't know if this forum deals with coding in odoo but i really just need help


here is the custom XML code


        <!-- Customer Statement Report -->
   <record id="action_print_customer_statement_aged" model="ir.actions.report">
    <field name="name">Print Aged Statement</field>
    <field name="model">res.partner</field>
    <field name="report_type">qweb-pdf</field>
    <field name="report_name">zra_smart_invoice.report_customer_statement_aged</field>
    <field name="report_file">zra_smart_invoice.report_customer_statement_aged</field>
    <field name="print_report_name">'Statement - %s' % (object.name)</field>
    <field name="binding_model_id" ref="model_res_partner"/>
    <field name="binding_type">report</field>
</record>


<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <!-- Main report template (MUST be this exact structure) -->
    <template id="report_customer_statement_aged">
    <t t-name="zra_smart_invoice.report_customer_statement_aged">
        <t t-call="zra_smart_invoice.external_layout">
            <t t-foreach="docs" t-as="doc">
             
                    <div class="page">
                        <!-- Header Section -->
                        <div class="header" style="margin-bottom: 20px;">
                            <h1 style="text-align: center;">CUSTOMER STATEMENT</h1>
                            <div style="text-align: center;">
                                <span t-out="context.get('date_from')"/> to <span t-out="context.get('date_to')"/>
                            </div>
                        </div>

                        <!-- Customer Info -->
                        <div style="margin-bottom: 30px;">
                            <address t-field="doc" t-options="{'widget': 'contact', 'fields': ['address', 'name', 'vat'], 'no_marker': True}"/>
                        </div>

                        <!-- Transactions Table -->
                        <t t-set="statement_lines" t-value="doc._get_statement_lines()"/>
                        <table class="table table-bordered" style="width: 100%;">
                            <thead>
                                <tr>
                                    <th>Date</th>
                                    <th>Description</th>
                                    <th>Due Date</th>
                                    <th class="text-end">Amount</th>
                                    <th class="text-end">Balance</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr t-foreach="statement_lines" t-as="line">
                                    <td><span t-out="line.get('date')"/></td>
                                    <td><span t-out="line.get('activity')"/></td>
                                    <td><span t-out="line.get('due_date')"/></td>
                                    <td class="text-end">
                                        <span t-out="line.get('amount')" t-options="{'widget': 'monetary', 'display_currency': doc.company_id.currency_id}"/>
                                    </td>
                                    <td class="text-end">
                                        <span t-out="line.get('balance')" t-options="{'widget': 'monetary', 'display_currency': doc.company_id.currency_id}"/>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

                        <!-- Aging Analysis -->
                        <div style="margin-top: 40px;">
                            <h3 style="border-bottom: 1px solid #000;">AGING ANALYSIS</h3>
                            <t t-set="aging_data" t-value="doc._get_aging_data()"/>
                            <table class="table" style="width: 100%;">
                                <tr>
                                    <td class="text-center"><strong>Current</strong></td>
                                    <td class="text-center"><strong>1-30 Days</strong></td>
                                    <td class="text-center"><strong>31-60 Days</strong></td>
                                    <td class="text-center"><strong>61-90 Days</strong></td>
                                    <td class="text-center"><strong>Over 90 Days</strong></td>
                                </tr>
                                <tr>
                                    <td class="text-center" t-out="aging_data.get('current', 0.0)" t-options="{'widget': 'monetary'}"/>
                                    <td class="text-center" t-out="aging_data.get('1-30', 0.0)" t-options="{'widget': 'monetary'}"/>
                                    <td class="text-center" t-out="aging_data.get('31-60', 0.0)" t-options="{'widget': 'monetary'}"/>
                                    <td class="text-center" t-out="aging_data.get('61-90', 0.0)" t-options="{'widget': 'monetary'}"/>
                                    <td class="text-center" t-out="aging_data.get('over_90', 0.0)" t-options="{'widget': 'monetary'}"/>
                                </tr>
                            </table>
                        </div>
                    </div>
                </t>
            </t>
        </t>
    </template>
</odoo>

0
Avatar
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,


You are not inheriting a view, but you're defining a standalone QWeb report template, which means your outer <template> should not have a parent reference, and your XML needs proper registration.


Try the following.


Change the template as,


<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- PDF Template for Customer Statement -->
<template id="report_customer_statement_aged">
<t t-name="zra_smart_invoice.report_customer_statement_aged">
<t t-call="web.external_layout">
<t t-foreach="docs" t-as="doc">
<div class="page">
<!-- Your layout here -->
</div>
</t>
</t>
</t>
</template>
</odoo>


Ensure you are using t-name, not nesting inside another <template> tag unless you are explicitly inheriting. Also, use web.external_layout or your custom layout like zra_smart_invoice.external_layout only if it exists.


Hope it helps

0
Avatar
Descartar
Avatar
Christoph Farnleitner
Best Answer

The three most likely reasons for Element 'x' cannot be located in parent view are:

  • it really just doesn't exist
  • typos
  • the sequence of loading data and view files or the records inside

While you will have to check for typos on your own, the second reason, sequence of loading, means that 'zra_smart_invoice.report_customer_statement_aged' must be defined prior to it being used (i.e. in the data key in your manifest make sure the file holding the definition is loaded before anything that needs it; and, inside one xml file, make sure it is likewise defined prior to being used).

Here however, I have no idea what <t t-name="zra_smart_invoice.report_customer_statement_aged"> is supposed to be as it seems to be the same as the template it is actually using.

0
Avatar
Descartar
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
more labels to a ledger XML data odoo 10
xml xml_id
Avatar
0
de gen. 18
3847
Why required attr used on field in xml doesn't work in V17? Solved
xml Technical odoo17
Avatar
Avatar
Avatar
2
de juny 25
5312
Issues with Populating Odoo's Customer Statements Report and Sending via Email Using XML Template
xml attachments odoo17
Avatar
1
d’ag. 24
2328
Odoo 17 generating blank QWeb.
xml qweb odoo17
Avatar
0
d’ag. 24
2562
readonly to a group and when the stage is in 2, 3, 4
xml studio odoo17
Avatar
Avatar
1
de juny 24
2265
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