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

Inherit Qweb

Subscriure's

Get notified when there's activity on this post

This question has been flagged
v8qwebinheritreport
4 Respostes
49703 Vistes
Avatar
Alex

In the new report module we have the company external header in /views/layouts.xml. Its ID is report.external_layout_header. If I edit the view directly in Odoo, it changes but now I want to inherit it in a module and I am not able to do that. I am not a coder so maybe it's a dummy problem.

This is the original view:

<t t-name="report.external_layout_header">
    <div class="header">
        <div class="row">
            <div class="col-xs-3">
                <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
            </div>
            <div class="col-xs-9 text-right" style="margin-top:20px;" t-field="company.rml_header1"/>
        </div>
        <div class="row zero_min_height">
            <div class="col-xs-12">
                <div style="border-bottom: 1px solid black;"/>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-3">
                <div t-field="company.partner_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: true}" style="border-bottom: 1px solid black;"/>
            </div>
        </div>
    </div>
</t>

 

So I create my module with empty __init__.py and I call the qweb view in __openerp__.py like this:

'qweb': ['views/my_layouts.xml',],

In my_layouts.xml I extend the view like this:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

<templates>

<t t-extend="report.external_layout_header">
            <t t-jquery="div.header" t-operation="replace">

            <<MY CODE>>

            </t>
</t>

</templates>

    </data>
</openerp>

But not works. I can install my module without error but the header doesn't change. I don't know where is the error so any help is appreciated. Thank you.

0
Avatar
Descartar
Avatar
Artur Bertram
Best Answer

Try it with the following code in your "views/my_layouts.xml".

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="report_header_custom" inherit_id="report.external_layout_header">
            <xpath expr="//div[@class='header']" position="replace">
                <div class ="header">
                    Your Code
                </div>
            </xpath>
        </template>
    </data>
</openerp>

Add the report in youre "__openerp__.py" file in the data.

'data': ['views/my_layouts.xml',],

And dont forget the depends.

'depends': ['base_setup',  'report', ],

7
Avatar
Descartar
Avatar
Peter Nietz
Best Answer

Hi, do you use <templates>  ...   </templates>  in your qweb xml? It is needed.

Another thing could be a dependency. In the __openerp__.py give the dependencies to the report module like:

'depends':['whaterver_report',],

andalso in your __init__.py import ur custom_module.py if one is used.

Then try this in your xml template file:

<templates>

<t t-extend="report.external_layout_header">
            <t t-jquery=".header" t-operation="replace">

                  <div class="header">
                      <div id="change_test"/>

                           <<< your code >>>

                  </div>

            </t>
</t>

</templates>

0
Avatar
Descartar
Alex
Autor

Yes, I use tag. I edit my post sorry. Don't I need to use them?

Alex
Autor

hahaha same error. I use

Peter Nietz

The tag must be used. Otherwise your code looks fine. I will try to reproduce your problem and have a look at it.

Alex
Autor

Thank you so much Peter. Furthermore I am just testing so I am not adding difficult code, just deleting for example the company tagline. So I can't understand where is the problem.

Peter Nietz

Inheritence of QWEB isn't very intuitiv ... I now experience the problem that the template from which I inherit produces errors even though I didn't change anything in it, but only my custom template ... why?!?!? So code of my custom modul is now used in standard modules... so where is the point of inheritance?

Peter Nietz

I edited my answer, try it and then take a look with fe. firebug if the id change_test is included. For me this worked. Hope it helps u...

Avatar
Andreas Tolstov
Best Answer

I think you don't need <openerp> and <data> tags in qweb templates.

Only in view templates.

0
Avatar
Descartar
Alex
Autor

Maybe they are not necessary because if I delete them I have no install error, but don't solve the main problem. Here there is someone with the same problem. https://www.odoo.com/forum/Help-1/question/Edit-the-qweb-template-with-a-custom-modul-54304

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
Create QWeb reports from Odoo application
v8 qweb report
Avatar
0
de des. 15
5106
Set report orientation Solved
v8 qweb report
Avatar
Avatar
1
de març 15
15055
Edit the qweb template with a custom modul. Solved
v8 qweb report
Avatar
Avatar
Avatar
3
de març 15
18852
Transfer the sum of all order lines of one page to the next page.
v8 qweb report
Avatar
0
de març 15
3945
How do you use variables in a Qweb loop? Solved
v8 qweb report loop
Avatar
Avatar
Avatar
Avatar
Avatar
11
d’abr. 23
94509
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