Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
3199 Представления

Hello, I need help and I have a question about invoice editing (report) : 

So basically as you may know via the settings in Odoo, we can choose and web external layout for all documents (light - striped - bold - boxed), so I use the striped that uses the "web.external_layout_striped" view for all reports pdf (purchase order, invoice document...)

But I want to apply modifications on the "web.external_layout_striped" that are only visible for invoice documents, how can I do that by inheriting in XML the view  "web.external_layout_striped" ? Maybe with a specific "IF" statement?

Example : If I inherit the "web.external_layout_striped" view and add a div on it, the div will appear on all documents, I don't want that, I want the div to only be visible for invoice documents.

Thanks ! 

Аватар
Отменить
Лучший ответ

Hi,

To make any customization in the report layout striped you can inherit the template "web.external_layout_striped" and if you want to add the customization only for the invoice module please try with adding a condition "t-if="o._name == 'account.move'""


example


<template id="inherit_external_layout_striped"
inherit_id="web.external_layout_striped">

             <div t-if=o._name == 'account.move'>

         

            # Your custom code

              

            </div>
<xpath expr="//t[@t-call='web.external_layout_striped']" position="replace">

        </xpath>

</template>


Hope it helps

Аватар
Отменить
Автор Лучший ответ

Hello Jort, first thanks for your answer, 

Can't i do that by inheriting the web.external_layout_striped view? I prefer to use this model for all reports (especially the grids), because as I understand your post on your blog, we create another custom layout, is it not possible to inherit an existant layout? 

Sincerly yours

Аватар
Отменить

The web.external_layout_striped view layout uses the attribute t-att-data-oe-model="o and o._name", e.g., <span t-field="o.name"/>. So you could try to use (e.g., t-if) specific invoice related items using o.item. But this really depends on your use case.

Лучший ответ

The items displayed on the invoice are specified in the report_invoice_document​ template from the account module: https://github.com/odoo/odoo/blob/16.0/addons/account/views/report_invoice.xml. So you would need to extend this template to add your modifications. See this post: https://www.odoo.com/forum/help-1/add-bank-account-number-under-company-details-of-a-invoice-odoo-16-community-edition-236599#answer-236603

I hope this helps!

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
дек. 23
1965
3
мар. 15
5693
0
мар. 15
3722
0
мар. 24
1382
0
нояб. 23
941