تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
4 الردود
4081 أدوات العرض

Hi, please help me, I'd like to remove all company informations from report but it occurs an error.

Here is my code (UPDATED):


<template id="empty_report" inherit_id="web.external_layout_standard">
<xpath expr="//div[@class='header']" position="replace">
<div class="header">
<div class="row">
<div class="col-3 mb4">
</div>
</div>
</div>
</xpath>
<xpath expr="//div/div/ul[@class='list-inline mb4']" position="replace">

</xpath>
<xpath expr="//div/div/div[@name='financial_infos']" position="replace">
<div name="financial_infos">
</div>
</xpath>
</template>


Here is the error (UPDATED):


Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1671, in report_download
    response = self.report_routes(reportname, docids=docids, converter=converter)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 519, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1612, in report_routes
    pdf = report.with_context(context).render_qweb_pdf(docids, data=data)[0]
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 716, in render_qweb_pdf
    bodies, html_ids, header, footer, specific_paperformat_args = self.with_context(context)._prepare_html(html)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 346, in _prepare_html
    body_parent = root.xpath('//main')[0]
IndexError: list index out of range


But it work perfectly when I access to PDF from this url:

http://localhost:8069/report/pdf/stock.report_deliveryslip/1

But it dosn't work when I try to access from Print button and give me the error above.


Thank you for helping!

Regards

الصورة الرمزية
إهمال

I can not relate the error message to the code snippet you have provided.

الكاتب

Hi, thanks! I don't understand either. I just want to remove company logo and other informations about this company. How I supposed to do that? Have you any solution?

الكاتب

Please see my updated question.

أفضل إجابة

Hi!

In your code, don't use the attribute "replace" because other module reference to it too, I suggest you to use "attributes" like the bellow code and after just add a CSS Style to hide the content.

<xpath expr="//header" position="attributes">
<attribute name="class">header_hidden</attribute>
</xpath>
CSS Style
.header_hidden {
visibility: hidden;
}

Best regards!

الصورة الرمزية
إهمال

Thank you, Sylvain. It works for me

المنشورات ذات الصلة الردود أدوات العرض النشاط
3
أغسطس 25
25346
0
ديسمبر 18
6010
1
يناير 20
4456
1
مايو 19
3965
1
أغسطس 21
4343