Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
14424 Widoki

I'd like to change the layout used by some of the default Odoo's report templates. So for example, the next code could be the first lines of the Stock Picking report:

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

<odoo>
<data>
<template id="report_picking">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">

But I'd like to change the t-call to 

<t t-call="web.internal_layout">

But if do so, I will have to copy all the content of the template inside my new t-call="web.internal_layout" ...

What I've currently done, is this here:

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

<odoo>
<data>
<template id="stock.report_picking">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.internal_layout">

Overriding the original template, but this approach doesn't look a really solution, so I'm not following the inheritance flow (inherit_id), and here below is what I'd like hypothetically to do, but seems to be imposible to reach and alter the t t-call tag:

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

<odoo>
<data>
<template id="my_new_picking_template" inherit_id="stock.report_picking">
<xpath expr="//t/t/t" position="attributes">
<attribute name="t-call">web.internal_layout</attribute>
</xpath>

Is something like this or something similar possible? :)

Awatar
Odrzuć
Najlepsza odpowiedź

Hello,

You can also use the xpath like this:

        <xpath expr="//t[@t-call='web.external_layout']" position="attributes">
            <attribute name="t-call">web.internal_layout</attribute>
        </xpath>

Hope it will work for you.

Thanks,

Awatar
Odrzuć
Autor

OOh!, I don't know how I didn't see that before, thanks :), I was trying to 'replace' that tag but that was a bad idea.

Powiązane posty Odpowiedzi Widoki Czynność
1
lut 22
1927
0
lip 20
1983
0
mar 15
2845
2
sty 24
4639
3
mar 15
5653